|
From: Travis O. <oli...@ie...> - 2006-01-13 00:46:30
|
Joris De Ridder wrote: >>>>y = array([1, nan, 0.47]) >>>>sort(y) >>>> >>>> >array([ 1. , nan, 0.47 ]) > >No exception, no sorting. Is this a feature or a bug? :) > > It's a "problem" that the user needs to be aware of, but I'm not sure how to fix. Notice that the same problem exists with python try: b =y.tolist() b.sort() Same effect. The problem may be that nans are always False on comparison with another object and this ends up confusing the sort functions. To fix it we would have to write a special nan-sort or else remove the nans entirely, but I don't think we should check for nans for every sort of floating-point values, because it would be slower. So, the user needs to do that. -Travis |