[Numpy-discussion] Why multiple ellipses?

Sasha ndarray at mac.com
Fri Feb 24 13:30:03 EST 2006


Numpy allows multiple ellipses in indexing expressions, but I am not
sure if that is useful.  AFAIK, ellipsis stands for "as many :'s as
needed", but if there is more than one, how do I know how many :'s
each of them represents:

>>> x = arange(8)
>>> x.shape=(2,2,2)
>>> x[0,...,0,...]
array([0, 1])
>>> x[0,0,:]
array([0, 1])
>>> x[0,:,0]
array([0, 2])

In the example above, the first ellipsis represents no :'s and the
last one represents one.  Is that the current rule that the last
ellipsis represents all the needed :'s?   What is the possible use for
that?




More information about the NumPy-Discussion mailing list