[Numpy-discussion] numarray uses "rank" instead "ndim"

Sebastian Haase haase at msg.ucsf.edu
Tue Jul 18 19:40:45 CDT 2006


Hi,
(Thanks to Travis and Todd for answering my last "dot"-question)

I'm trying to adjust my numarray based code to also run with numpy.
It seems that a (maybe the only left) problem is that numarray had
arr.rank  giving the value of len(arr.shape)
while in numpy this is now called 
arr.ndim

Is the "ndim" attribute already added in the CVS version (just now I could not 
connect to the CVS server) ?  Or else, could it be added to numarray to ease 
the transition !?
Another way might be to go back to len(arr.shape)  - but that would be quite 
ugly ...

Also I noted that a numpy array object does not allow "sticking" a new 
attribute into it: In numarray I could just say arr.xyz0='test'  like with 
any (simple) Python object - in numpy I get an
AttributeError: 'numpy.ndarray' object has no attribute 'xyz0'
!?

Thanks for everybody help.
Sebastian Haase





More information about the Numpy-discussion mailing list