[Numpy-discussion] Weird slicing behavior

David Huard david.huard at gmail.com
Fri May 12 22:09:53 EDT 2006


Hi,

I noticed that slicing outside bounds with lists returns the whole list :
>>> a = range(5)
>>> a[-7:]
[0, 1, 2, 3, 4]

while in numpy, array has a weird behavior
>>> a = numpy.arange(5)
>>> a[-7:]
array([3, 4])   # Ok, it takes modulo(index, length)

but

>>> a[-11:]
array([0, 1, 2, 3, 4]) # ???

Cheers,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060512/f494ac44/attachment.html>


More information about the NumPy-Discussion mailing list