[Numpy-discussion] bug in negative stride indexing for empty arrays

eric eric at enthought.com
Sat Jun 1 13:20:42 CDT 2002


Hi,

I just ran across a situation where reversing an empty array using a negative
stride populates it with a new element.  I'm betting this isn't the intended
behavior.

An example code snippet is below.

eric

C:\home\ej\wrk\chaco>python
Python 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> from Numeric import *
>>> import Numeric
>>> Numeric.__version__
'21.0'
>>> a = array(())
>>> a
zeros((0,), 'l')
>>> len(a)
0
>>> b = a[::-1]
>>> len(b)
1
>>> b
array([0])


--
Eric Jones <eric at enthought.com>
Enthought, Inc. [www.enthought.com and www.scipy.org]
(512) 536-1057






More information about the Numpy-discussion mailing list