Attempting to set the element of a 0-d array by indexing it with (...,) causes an IndexError, but similar operations with Ellipsis work correctly:
>>> a = numpy.array(1)
>>> a[...] = 4
>>> a[(...,)] = 5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: 0-d arrays can't be indexed.
I assume this should be allowed? It came up in some code along the following lines:
a = numpy.zeros(b.shape + c.shape)
for i in numpy.ndindex(c.shape):
a[(...,) + i] = something
which fails to work when c is zero-dimensional.
You probably got that already, but if you need a workaround, c[(slice(None),) * a.ndim + index] will work, since the empty tuple does not have this issue.
c[(slice(None),) * a.ndim + index]
TST: added test for issue #3017.
Also changed style to please numpy developers.
BUG: fix #3017 Inconsistency in indexing 0-d arrays with Ellipsis.