[Numpy-tickets] [NumPy] #911: python2.4: indexing list with Numpy some integer scalars does not work

NumPy numpy-tickets@scipy....
Thu Sep 11 09:37:51 CDT 2008


#911: python2.4: indexing list with Numpy some integer scalars does not work
------------------------+---------------------------------------------------
 Reporter:  pv          |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  1.3.0   
Component:  numpy.core  |     Version:  none    
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 On a 64-bit platform with Python 2.4 indexing a list with a Numpy integer
 scalar of non-platform native size fails:
 {{{
 Python 2.4.4 (#2, Apr 16 2008, 17:58:59)
 [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
 '1.2.0rc2'
 >>> x=[1,2,3]
 >>> x[np.int32(0)]
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 TypeError: list indices must be integers
 >>> x[np.int64(0)]
 1
 >>> np.int_ is np.int64
 True
 }}}

 It works with Numpy on Python 2.5:
 {{{
 Python 2.5 (release25-maint, Jul 23 2008, 18:15:29)
 [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
 '1.1.1'
 >>> x=[1,2,3]
 >>> x[np.int32(0)]
 1
 >>> x[np.int64(0)]
 1
 >>> np.int_ is np.int64
 True
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/911>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list