[Numpy-discussion] Inconsistency with __index__() for rank-1 arrays?
Pauli Virtanen
pav@iki...
Fri Oct 29 05:18:20 CDT 2010
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.
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list