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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com