Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109641 > unrolled thread
| Started by | Harrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au> |
|---|---|
| First post | 2016-06-08 10:17 +1000 |
| Last post | 2016-06-08 00:45 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Possible PEP - two dimensional arrays? Harrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au> - 2016-06-08 10:17 +1000
Re: Possible PEP - two dimensional arrays? Paul Rubin <no.email@nospam.invalid> - 2016-06-07 17:28 -0700
Re: Possible PEP - two dimensional arrays? Ned Batchelder <ned@nedbatchelder.com> - 2016-06-07 17:38 -0700
Re: Possible PEP - two dimensional arrays? Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-06-08 00:45 +0000
| From | Harrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au> |
|---|---|
| Date | 2016-06-08 10:17 +1000 |
| Subject | Possible PEP - two dimensional arrays? |
| Message-ID | <mailman.66.1465345153.2306.python-list@python.org> |
I was programming a computer game and found that while 1D arrays can be created using the module array, there is no module for two-dimensional arrays, unlike languages like C. Currently, the closest thing Python has to a 2D array is a dictionary containing lists. I propose that a module , 2DArray, be added to the standard library. This module will include: Assignment and retrieval on items on a two-dimensional, finite rectangular grid. Types are integer, float, character and string. Resizing the grid - parameters are old size and new size. Any new elements are initialized with a value of 0 for int, 0.0 for float and ' ' for string and character arrays. Removing elements. The parameter is the location. After removal, the value returned is 0 for int, 0.0 for float and ' ' for string and character arrays. A function, pop(), which removes elements from the grid and then returns them. Is this idea PEPable? ******************************************************************************* This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender.
[toc] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-06-07 17:28 -0700 |
| Message-ID | <8737oobk20.fsf@jester.gateway.pace.com> |
| In reply to | #109641 |
Harrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au> writes:
> Currently, the closest thing Python has to a 2D array is a dictionary
> containing lists.
Tuples work fine:
d = {}
d[2,3] = 5 # etc...
> Is this idea PEPable?
I don't think it would get any traction. If you're doing something
numerical that needs 2d arrays, numpy supports them. Actually, looking
at your application, numpy might be what you want.
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2016-06-07 17:38 -0700 |
| Message-ID | <117c8a99-56eb-4369-9392-40d25d70697c@googlegroups.com> |
| In reply to | #109641 |
On Tuesday, June 7, 2016 at 8:19:33 PM UTC-4, Harrison Chudleigh wrote: > I was programming a computer game and found that while 1D arrays can be > created using the module array, there is no module for two-dimensional > arrays, unlike languages like C. Currently, the closest thing Python has to > a 2D array is a dictionary containing lists. > > I propose that a module , 2DArray, be added to the standard library. This > module will include: > Assignment and retrieval on items on a two-dimensional, finite rectangular > grid. Types are integer, float, character and string. > Resizing the grid - parameters are old size and new size. Any new elements > are initialized with a value of 0 for int, 0.0 for float and ' ' for string > and character arrays. > Removing elements. The parameter is the location. After removal, the value > returned is 0 for int, 0.0 for float and ' ' for string and character > arrays. > A function, pop(), which removes elements from the grid and then returns > them. > > Is this idea PEPable? People who need arrays like this generally use numpy, which has good support for N-dimensional arrays and all of the operations you'd like on them. I don't think Python would consider adding something like this to the standard library since numpy is available. --Ned.
[toc] | [prev] | [next] | [standalone]
| From | Rob Gaddi <rgaddi@highlandtechnology.invalid> |
|---|---|
| Date | 2016-06-08 00:45 +0000 |
| Message-ID | <nj7prd$4hq$1@dont-email.me> |
| In reply to | #109641 |
Harrison Chudleigh wrote: > I was programming a computer game and found that while 1D arrays can be > created using the module array, there is no module for two-dimensional > arrays, unlike languages like C. Currently, the closest thing Python has to > a 2D array is a dictionary containing lists. > > I propose that a module , 2DArray, be added to the standard library. This > module will include: > Assignment and retrieval on items on a two-dimensional, finite rectangular > grid. Types are integer, float, character and string. > Resizing the grid - parameters are old size and new size. Any new elements > are initialized with a value of 0 for int, 0.0 for float and ' ' for string > and character arrays. > Removing elements. The parameter is the location. After removal, the value > returned is 0 for int, 0.0 for float and ' ' for string and character > arrays. > A function, pop(), which removes elements from the grid and then returns > them. > > Is this idea PEPable? > ******************************************************************************* > This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. You're looking for numpy. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web