[Scipy-tickets] [SciPy] #656: numpy.sort sometimes doesn't handle strings right

SciPy scipy-tickets@scipy....
Fri Apr 25 02:03:55 CDT 2008


#656: numpy.sort sometimes doesn't handle strings right
--------------------+-------------------------------------------------------
 Reporter:  jloper  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  0.7     
Component:  Other   |     Version:          
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 >>>
 numpy.sort(numpy.array(['\x01\x00\x02','\x01\x00\x04','\x01\x00\x02']))
 array(['\x01\x00\x02', '\x01\x00\x04', '\x01\x00\x02'],
       dtype='|S3')
 >>> '\x01\x00\x02'<'\x01\x00\x04'
 True
 >>> '\x01\x00\x02'>'\x01\x00\x04'
 False


 looks like the greater than and less than operators work as expected, but
 sort doesn't do what's expected.

 this might seem a bit trivial (and there may be a "good" reason it's not
 doing the expected thing) but people are using a.view("S8") in order to
 use unique() on a row-by-row basis.

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/656>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list