[Numpy-discussion] edge-cases of ellipsis indexing
Antony Lee
antony.lee at berkeley.edu
Mon Jan 5 02:34:09 EST 2015
While trying to reproduce various fancy indexings for astropy's FITS
sections (a loaded-on-demand array), I found the following interesting
behavior:
>>> np.array([1])[..., 0]
array(1)
>>> np.array([1])[0]
1
>>> np.array([1])[(0,)]
1
The docs say "Ellipsis expand to the number of : objects needed to make a
selection tuple of the same length as x.ndim.", so it's not totally clear
to me how to explain that difference in the results.
Antony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150105/def9239d/attachment.html>
More information about the NumPy-Discussion
mailing list