[Numpy-tickets] [NumPy] #736: Inconsistent integer conversion from strings

NumPy numpy-tickets@scipy....
Sat Apr 12 18:10:02 CDT 2008


#736: Inconsistent integer conversion from strings
--------------------+-------------------------------------------------------
 Reporter:  stefan  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  1.0.5   
Component:  Other   |     Version:  none    
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 Pauli Virtanen noticed the following behaviour (mentioned as part of #719
 discussion):

 {{{
 In [8]: np.array([('123',), ('456',)], dtype=[('num', '<i8')])
 Out[8]:
 array([(123L,), (456L,)],
       dtype=[('num', '<i8')])
 }}}

 vs.

 {{{
 In [9]: np.array([('123',), ('456',)], dtype=[('num', '<i4')])

 TypeError: expected a readable buffer object
 }}}

 I believe this is related to the following inconsistent integer-from-
 string conversions:

 {{{
 In [27]: np.int32('12')
 Out[27]: 12

 In [28]: np.int64('12')
 Out[28]: array([1, 2], dtype=int64)
 }}}

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


More information about the Numpy-tickets mailing list