On Jun 9, 2006, at 4:55 PM, Greg Ewing wrote: ... > Think about how you get from an N dimensional array to > an N-1 dimensional array: you index it, e.g. > > A2 = [[1, 2], [3, 4]] # a 2D array > > A1 = A2[1] # a 1D array > > A0 = A1[1] # a 0D array??? > > print A0 > > What do you think this will print? Don't confuse arrays with lists...: >>> A2 = Numeric.array([[1, 2], [3, 4]], Numeric.Float32) >>> A1 = A2[1] >>> A0 = A1[1] >>> type(A0) <type 'array'> >>> It doesn't work the same if you specify Numeric.Float64 instead -- an ancient wart of Numeric, of course. Still, Numeric and its descendants are "the" way in Python to get multi-dimensional arrays, since the stdlib's array module only supports one-dimensional ones, and lists are not arrays. Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4