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

Charles R Harris charlesr.harris at gmail.com
Wed Feb 13 16:27:08 EST 2008


On Feb 13, 2008 1:52 PM, Matthew Brett <matthew.brett at gmail.com> wrote:

> 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?
>

I think it is possible to make sort work with the None keyword, So I think
the question is whether or not we want it to. If we do, then the current
lack is a bug, if we don't, then the documentation needs to be fixed.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080213/55c15c5b/attachment.html>


More information about the NumPy-Discussion mailing list