[Numpy-tickets] [NumPy] #302: Fancy indexing and python 2.5 issue
NumPy
numpy-tickets at scipy.net
Mon Oct 2 05:20:59 CDT 2006
#302: Fancy indexing and python 2.5 issue
--------------------+-------------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
Hi,
I think I've detected a bug with fancy indexing and python 2.5. The next
exposes the problem:
With python 2.4:
{{{
>>> numpy.array([1,2])[numpy.array([0])]
array([1])
>>> numpy.array([1,2])[numpy.array([0])]
array([1])
>>> type(numpy.array([1,2])[numpy.array([0])])
<type 'numpy.ndarray'>
>>> numpy.array([1,2])[numpy.int32(0)]
1
>>> type(numpy.array([1,2])[numpy.int32(0)])
<type 'numpy.int32'>
}}}
But, with python 2.5:
{{{
>>> numpy.array([1,2])[numpy.array([0])]
1
>>> type(numpy.array([1,2])[numpy.array([0])])
<type 'numpy.int32'>
>>> numpy.array([1,2])[numpy.int32(0)]
1
>>> type(numpy.array([1,2])[numpy.int32(0)])
<type 'numpy.int32'>
}}}
IMO, indexing with and array should always give an array as output, not a
scalar, so I'd say that output for python2.5 is wrong. I'm using numpy
1.0.dev3239.
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/302>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list