[Numpy-tickets] [NumPy] #456: Inconsistent behaviour of representation of numpy scalar strings when NULLs exists

NumPy numpy-tickets@scipy....
Thu Mar 1 02:00:33 CST 2007


#456: Inconsistent behaviour of representation of numpy scalar strings when NULLs
exists
------------------------+---------------------------------------------------
 Reporter:  faltet      |        Owner:  somebody
     Type:  defect      |       Status:  closed  
 Priority:  normal      |    Milestone:          
Component:  numpy.core  |      Version:          
 Severity:  normal      |   Resolution:  fixed   
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by pv):

 I do not understand the rationale for getitem behaving differently from
 tostring. Is this a legacy feature inherited from Numeric?

 It would seem sensible for me that
 {{{
 >>> s = "a\x00b\x00"
 >>> x = numpy.array(s)
 >>> assert x[()] == x.tostring()
 }}}
 and that
 {{{
 >>> s = "a\x00b\x00"
 >>> x = numpy.array(s)
 >>> assert x[()] == s
 }}}
 would pass, since the latter passes for numerical scalar types. In python
 strings, the character "\x00" is not treated specially, so I do not see
 why it is special for numpy.

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


More information about the Numpy-tickets mailing list