[NumPy-Tickets] [NumPy] #1960: chararray assignment doesn't work as expected

NumPy Trac numpy-tickets@scipy....
Sat Oct 8 15:32:42 CDT 2011


#1960: chararray assignment doesn't work as expected
------------------------+---------------------------------------------------
 Reporter:  pv          |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.0      
 Keywords:              |  
------------------------+---------------------------------------------------
 Pasted from http://projects.scipy.org/scipy/ticket/1532 by 'faheem'. Seems
 to be also in current git master like this.
 --------------
 The following code is from the Numpy 1.6.0 manual,
 [http://docs.scipy.org/doc/numpy-1.6.0/reference/generated/numpy.chararray.html#numpy.chararray].
 I've tested with 1.6.1 on Debian squeeze. There is a similar link in the
 development docs
 [http://docs.scipy.org/doc/numpy/reference/generated/numpy.chararray.html#numpy.chararray].

 {{{
 import numpy as np
 charar = np.chararray((3, 3))
 charar[:, :] = 'abc'
 print charar
 }}}

 According to the manual, this is supposed to output

 {{{
 chararray([['a', 'a', 'a'],
        ['a', 'a', 'a'],
        ['a', 'a', 'a']],
       dtype='|S1')

 }}}

 Instead I get

 {{{
 [['\xd8' '3' 'U']
  ['\xb7' '\x18' '\xc2']
  ['\xbd' '' '\x10']]
 }}}

 This looks like uninitialized values. I haven't tested to see if I can
 reproduce this in the dev version.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1960>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list