[Numpy-discussion] sort method raises unexpected error with axis=None

Matthew Brett matthew.brett at gmail.com
Wed Feb 13 15:52:25 EST 2008


Ah,

To answer my own question:

> Suggestion 1:
> Wrap the .sort method call in a tiny python wrapper of the form:
>
> def sort(self, axis=-1, kind='quicksort', order=None):
>     if axis=None:
>        _c_sort(self.ravel(), axis, kind, order)
>    else:
>       _c_sort(self, axis, kind, order)

I guess this is not good because self.ravel might return a copy, in
situations I don't think I fully grasp?  Guessing that there is no
other way to do a guaranteed inplace sort for axis=None, I guess that
making that clear in the method docstring is the best way to go?

Matthew



More information about the NumPy-Discussion mailing list