[Numpy-tickets] [NumPy] #283: Inconsisteny in enumerated type mapping

NumPy numpy-tickets at scipy.net
Mon Sep 18 02:23:51 CDT 2006


#283: Inconsisteny in enumerated type mapping
------------------------+---------------------------------------------------
 Reporter:  faltet      |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  1.0 Release
Component:  numpy.core  |     Version:  devel      
 Severity:  normal      |    Keywords:             
------------------------+---------------------------------------------------
 Hi,

 I think that I've detected an inconsistency in NumPy enumerated type
 mapping:

 {{{
 >>> numpy.array(1, dtype=numpy.int32).dtype.num
 7
 >>> numpy.array(1, dtype=numpy.int_).dtype.num
 7
 }}}

 IMO, numpy.int32 should return 5 (NPY_INT) instead of 7 (NPY_LONG), even
 in 32-bit platforms (like mine). In fact, dtype 'i' is returning the
 correct enum code:

 {{{
 >>> numpy.array(1, dtype='i').dtype.num
 5
 }}}

 Similarly, I think that the next map is wrong:

 {{{
 >>> numpy.typeDict[7]
 <type 'numpy.int32'>
 >>> numpy.typeDict['l']
 <type 'numpy.int32'>
 }}}

 and I'd say that the correct values should be:

 {{{
 >>> numpy.typeDict[7]
 <type 'numpy.int_'>
 >>> numpy.typeDict['l']
 <type 'numpy.int_'>
 }}}

 This would allow better portability of NPY_INT and NPY_LONG between 32 and
 64 bit platforms.

 Thanks!

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


More information about the Numpy-tickets mailing list