[Scipy-tickets] [SciPy] #1532: simple numpy example from manual does not work as expected

SciPy Trac scipy-tickets@scipy....
Sat Oct 8 15:05:42 CDT 2011


#1532: simple numpy example from manual does not work as expected
--------------------+-------------------------------------------------------
 Reporter:  faheem  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  devel      
 Keywords:          |  
--------------------+-------------------------------------------------------
 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/scipy/ticket/1532>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list