[Numpy-tickets] [NumPy] #916: Inconsistency in type equality

NumPy numpy-tickets@scipy....
Mon Sep 22 04:07:45 CDT 2008


#916: Inconsistency in type equality
--------------------+-------------------------------------------------------
 Reporter:  faltet  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  1.2.0   
Component:  Other   |     Version:  none    
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 It seems to me that there is a inconsistency between the comparisons of
 dtype and dtype.type attributes of a !NumPy array.  The next shows the
 problem (ran on a 32-bit machine):

 {{{
 In [20]: a=numpy.array([2], 'i')

 In [21]: b=numpy.array([2], 'l')

 In [22]: a.dtype == b.dtype
 Out[22]: True

 In [23]: a.dtype.type == b.dtype.type
 Out[23]: False

 In [24]: a.dtype.type
 Out[24]: <type 'numpy.int32'>

 In [25]: b.dtype.type
 Out[25]: <type 'numpy.int32'>
 }}}

 I'd like to use arr.dtype.type instead of arr.dtype alone because there
 are situations where I want to check only for the raw type, without
 byteordering, shape or other considerations.

 Thanks,
 Francesc

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


More information about the Numpy-tickets mailing list