[Numpy-tickets] [NumPy] #312: numpy.rec.array doesn't create a copy of buffer passed

NumPy numpy-tickets at scipy.net
Wed Oct 4 04:26:50 CDT 2006


#312: numpy.rec.array doesn't create a copy of buffer passed
-----------------------+----------------------------------------------------
 Reporter:  faltet     |       Owner:  somebody   
     Type:  defect     |      Status:  new        
 Priority:  normal     |   Milestone:  1.0 Release
Component:  numpy.lib  |     Version:  devel      
 Severity:  minor      |    Keywords:             
-----------------------+----------------------------------------------------
 I don't know if the next behaviour is expected:

 {{{
 In [38]:ra=numpy.array([(1,2.3)], dtype="i2,f8")
 In [39]:ra2=numpy.rec.array(ra, dtype="i2,f8")
 In [40]:ra['f0']
 Out[40]:array([1], dtype=int16)
 In [41]:ra2['f0'] = 2
 In [42]:ra['f0']
 Out[42]:array([2], dtype=int16)

 }}}

 i.e. numpy.rec.array doesn't make a copy of the original array. I find
 this a bit counter-intuitive, because it seems to me that all the array()
 factories should deliver a copy of the buffer passed.

 In case this is the expected behaviour, I'd say that adding a "copy"
 parameter in numpy.rec.array would be convenient.

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


More information about the Numpy-tickets mailing list