[Numpy-tickets] [NumPy] #379: different error when slicing with Python 2.4 and 2.5
NumPy
numpy-tickets at scipy.net
Mon Nov 13 04:58:40 CST 2006
#379: different error when slicing with Python 2.4 and 2.5
------------------------------+---------------------------------------------
Reporter: benjamin.thyreau | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Keywords:
------------------------------+---------------------------------------------
Hi,
I happened to get an error when slicing with an array.
{{{
from numpy import *
names = arange(8)
v = array([8])
names[:v]
}}}
Python 2.4 outputs :
{{{array([0, 1, 2, 3, 4, 5, 6, 7])}}}
while Python 2.5 outputs :
{{{TypeError: only 0-d integerarrays can be converted to an index}}}
When {{{v = array([7, 8])}}}, Python 2.4 outputs
{{{IndexError: invalid slice}}}
This was tested using various >1.0 Numpy. On my case 1.0, 1.0.1.dev3416,
1.0.1.dev3432...
Since slicing with an 1-element array is wrong anyway, this shouldn't
occurs frequently, but might break badly-written code.
Thanks
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/379>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list