[Numpy-discussion] Matching 0-d arrays and NumPy scalars

Konrad Hinsen konrad.hinsen@laposte....
Thu Feb 21 01:47:43 CST 2008


On 21.02.2008, at 08:41, Francesc Altet wrote:

> Well, it seems like a non-intrusive modification, but I like the  
> scalars
> to remain un-indexable, mainly because it would be useful to raise an
> error when you are trying to index them.  In fact, I thought that when
> you want a kind of scalar but indexable, you should use a 0-d array.

I agree. In fact, I'd rather see NumPy scalars move towards Python  
scalars rather than towards NumPy arrays in behaviour. In particular,  
their nasty habit of coercing everything they are combined with into  
arrays is still my #1 source of compatibility problems with porting  
code from Numeric to NumPy. I end up converting NumPy scalars to  
Python scalars explicitly in lots of places.

Konrad.



More information about the Numpy-discussion mailing list