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

Eric Firing efiring@hawaii....
Thu Feb 21 11:34:07 CST 2008

Travis E. Oliphant wrote:
> Hi everybody,
> In writing some generic code, I've encountered situations where it would 
> reduce code complexity to allow NumPy scalars to be "indexed" in the 
> same number of limited ways, that 0-d arrays support.
> For example, 0-d arrays can be indexed with
>     * Boolean masks
>     * Ellipses x[...]  and x[..., newaxis]
>     * Empty tuple x[()]
> I think that numpy scalars should also be indexable in these particular 
> cases as well (read-only of course,  i.e. no setting of the value would 
> be possible).
> This is an easy change to implement, and I don't think it would cause 
> any backward compatibility issues.
> Any opinions from the list?
> Best regards,
> -Travis O.


You have been getting mostly objections so far; maybe it would help if 
you gave a simple specific example of how your proposal would simplify code.


More information about the Numpy-discussion mailing list