[Numpy-discussion] Small bug in MA with arrays of rank > 1
Fernando Perez
Fernando.Perez at colorado.edu
Mon Oct 4 10:59:49 CDT 2004
Hi all,
a while back I noticed a small problem with MA for rank 2 (and larger) arrays.
Here's a simple example:
In [1]: a=RA.random((3,3))
In [2]: a
Out[2]:
array([[ 0.002542, 0.70301 , 0.705466],
[ 0.467305, 0.381492, 0.655857],
[ 0.103372, 0.776988, 0.466528]])
In [3]: import MA
In [4]: a
Out[4]:
[[ 0.002542, 0.70301 , 0.705466,]
[ 0.467305, 0.381492, 0.655857,]
[ 0.103372, 0.776988, 0.466528,]]
The bug is that the commas at the end of each line are coming _before_ the
closing bracket, instead of after. This seemingly trivial problem turns out
to be pretty serious for me, because I use this string representation to
export python arrays into Mathematica files, by simply replacing [] with {}
(and playing some other tricks).
Unfortunately, this bug means I can't use MA, which is otherwise great because
of the way it gracefully handles the case where you accidentally say
A
when A is some monster array. With MA, instead of your CPU getting killed for
10 minutes, you get a nice summary of A's dimensions and typecode.
Anyway, it would be great if one of the gurus had a chance to fix this one.
Best,
f
More information about the Numpy-discussion
mailing list