[NumPy-Tickets] [NumPy] #1608: numpy.sort on x.flat modifies x

NumPy Trac numpy-tickets@scipy....
Thu Sep 9 20:08:03 CDT 2010


#1608: numpy.sort on x.flat modifies x
---------------------------+------------------------------------------------
 Reporter:  carlscheffler  |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:  1.5.1   
Component:  numpy.core     |     Version:  1.3.0   
 Keywords:  sort, flat     |  
---------------------------+------------------------------------------------

Comment(by charris):

 The problem lies elsewhere:


 {{{
 In [98]: x = numpy.array([[1,2],[3,4]]).T

 In [99]: x
 Out[99]:
 array([[1, 3],
        [2, 4]])

 In [100]: y = asanyarray(x.flat).flatten()

 In [101]: x
 Out[101]:
 array([[1, 2],
        [3, 4]])

 In [102]: x = numpy.array([[1,2],[3,4]]).T

 In [103]: y = asanyarray(x.flat)

 In [104]: x
 Out[104]:
 array([[1, 3],
        [2, 4]])
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1608#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list