[Numpy-discussion] Approving NEP 27 - Historical discussion of 0-D arrays

Hameer Abbasi einstein.edison at gmail.com
Wed Oct 17 14:34:04 EDT 2018

Hi everyone,

Ah, I neglected to see that the PR was already merged. In any case, I’ll repeat my comment here (referring to the indexing section):

I would suggest that this section be removed entirely or updated. For example, if xis either an array scalar or a rank zero array, x[...] is guaranteed to be an array and x[()]is guaranteed to be a scalar. The difference is because x[{anything here}, ...] is guaranteed to be an array. In words, if the last index is an ellipsis, the result of indexing is guaranteed to be an array.

I came across this weird behaviour when implementing the equivalent of np.wherefor PyData/Sparse.

Best Regards,
Hameer Abbasi

> On Wednesday, Oct 17, 2018 at 7:59 PM, Matti Picus <matti.picus at gmail.com (mailto:matti.picus at gmail.com)> wrote:
> In PR 12166 https://github.com/numpy/numpy/pull/12166 we revived an old
> wiki document discussing the implementation of 0-dimensional arrays.
> This became informational NEP-27
> http://www.numpy.org/neps/nep-0027-zero-rank-arrarys.html. There was
> fruitful discussion of the NEP and the need for both 0-D arrays and
> scalars on the PR comments. The NEP itself is informational and freezes
> the information to the 2006 discussion, noting that "some of the
> information here is dated, for instance indexing of 0-D arrays now is
> now implemented and does not error."
> I would like to submit the NEP for discussion and approval.
> Matti
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181017/238d7dd1/attachment-0001.html>

More information about the NumPy-Discussion mailing list