What order are array elements printed out by the
print
command?
Here's the answer directly from the Numerical Python manual:
The default printing routine provided by the Numeric module prints arrays as follows:The remaining axes are printed top to bottom with increasing numbers of separators.
- The last axis is always printed left to right
- The next-to-last axis is printed top to bottom
Thus, rank 1 and 2 arrays will print out on the screen in a form that corresponds to our mental map of their storage in memory:
>>> import Numeric as N >>> a = N.arange(12) >>> a [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,] >>> a = N.reshape(a, (3,4)) >>> a [[ 0, 1, 2, 3,] [ 4, 5, 6, 7,] [ 8, 9,10,11,]]
Reference: Ascher, D., et al. (2001): Numerical Python, Livermore, CA: Lawrence Livermore National Laboratory, UCRL-MA-128569, p. 17.