[SciPy-user] histogram bug ?

Travis Oliphant oliphant.travis at ieee.org
Fri Dec 30 14:37:37 CST 2005


Alan G Isaac wrote:

>On Fri, 30 Dec 2005, Alan G Isaac apparently wrote: 
>  
>
>>should a.sort() violate Pythonic expectations by returning a? 
>>    
>>
>
>Rephrasing:
>
>Currently scipy core does not follow the Python or numarray 
>convention of having the sort method sort the array in place
>and return None.  Instead it returns a sorted copy of the 
>old array, and leaves the old array untouched.
>  
>
This makes sense.  The reason for the current behavior is that it was 
Numeric's behavior -- but sort was a function.

So, clearly the sort function could still return a copy while the sort 
method does the in-place sort.   I had forgotten that sort was not a 
method in Numeric.

I think this is the right thing to do.  I don't think we need another 
.sorted method either: sort(a) will return the sorted copy just as it 
did in Numeric.

I'll do this as part of the change of inlining the sorting methods.

-Travis



More information about the SciPy-user mailing list