[Numpy-discussion] rank-0 arrays

Pearu Peterson pearu at cens.ioc.ee
Fri Sep 13 08:48:07 CDT 2002


On Fri, 13 Sep 2002, Todd Miller wrote:

> Two other issues come up trying to implement the "rank-0 experiment":
> 
> 1.  What should be the behavior of subscripting a rank-0 array?
> 
> a.  Return the scalar value                         (what numarray does 
> now.  seems inconsistent)

-0.5

> b.  Raise an exception

+1

> c.  Return a copy  of the rank-0 array

-1

> 2.  What's a decent notation for .asScalar()?
> 
> a.  a[ <subscript_resulting_in_rank0> ][0]                (what numarray 
> does now)

+-0, just be consistent.

> b.  a[ <subscript_resulting_in_rank0> ]()                  (override 
> __call__)

-1

> c.  a[ <subscript_resulting_in_rank0> ].asScalar()  

+0.5


Pearu





More information about the Numpy-discussion mailing list