[Numpy-discussion] IndexExpression bug?
Michael McNeil Forbes
mforbes at physics.ubc.ca
Fri Jun 5 17:14:57 EDT 2009
>>> np.array([0,1,2,3])[1:-1]
array([1, 2])
but
>>> np.array([0,1,2,3])[np.s_[1:-1]]
array([1, 2, 3])
>>> np.array([0,1,2,3])[np.index_exp[1:-1]]
array([1, 2, 3])
Possible fix:
class IndexExpression(object):
...
def __len__(self):
return 0
(Presently this returns sys.maxint)
Does this break anything (I can't find any coverage tests)? If not, I
will submit a ticket.
Michael.
More information about the NumPy-Discussion
mailing list