[Numpy-discussion] Inconsistency with __index__() for rank-1 arrays?

Francesc Alted faltet@pytables....
Fri Oct 29 05:48:06 CDT 2010


A Friday 29 October 2010 12:18:20 Pauli Virtanen escrigué:
> Fri, 29 Oct 2010 09:54:23 +0200, Francesc Alted wrote:
> [clip]
> 
> > My vote is +1 for deprecating ``array([scalar])`` as a scalar index
> > for NumPy 2.0.
> 
> I'd be -0 on this, since 1-element Numpy arrays function like scalars
> in several other contexts, e.g. in casting to Python types and in
> boolean context.
> 
> Note also that at least Python's struct module (mis-?)uses
> __index__() for casting inputs to integers.

Uh, could you put some examples of this please?

-- 
Francesc Alted


More information about the NumPy-Discussion mailing list