[Numpy-tickets] [NumPy] #290: Some inconsistency in 'i' typecode

NumPy numpy-tickets at scipy.net
Sun Sep 24 03:20:33 CDT 2006

#290: Some inconsistency in 'i' typecode
 Reporter:  faltet  |        Owner:  somebody
     Type:  defect  |       Status:  reopened
 Priority:  normal  |    Milestone:          
Component:  Other   |      Version:          
 Severity:  normal  |   Resolution:          
 Keywords:          |  
Changes (by faltet):

  * status:  closed => reopened
  * resolution:  invalid =>


 Ok. I think I understand. My problem is that I'm trying to use the data-
 type as a key in a dictionary and I can't make it work correctly:

 >>> {numpy.dtype(numpy.int32): 'found'}[numpy.dtype(numpy.int32)]
 >>> {numpy.dtype(numpy.int32): 'found'}[numpy.dtype(numpy.int_)]
 >>> {numpy.dtype(numpy.int32): 'found'}[numpy.dtype(numpy.intc)]
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 KeyError: dtype('<i4')

 the ultimate problem for this is that these data-types have different

 >>> hash(numpy.dtype(numpy.int32))
 >>> hash(numpy.dtype(numpy.int_))
 >>> hash(numpy.dtype(numpy.intc))

 There would be any chance that data-types int32 and intc would return the
 same hash? or should I find other workarounds for my code (i.e. don't
 using dictionaries for what I'm trying to do)?


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

More information about the Numpy-tickets mailing list