On Mon, Mar 24, 2014 at 12:08 PM, Alan G Isaac <alan.is...@gmail.com> wrote:
>> On Mon, Mar 24, 2014 at 11:32 AM, Alan G Isaac wrote:
>>>     I'm wondering if `sort` intentionally does not accept
>>>     a `key`
>>>     or if this is just a missing feature?
>
>
> On 3/24/2014 11:47 AM, Alexander Belopolsky wrote:
>> It would be very inefficient to call a key function on
>> every element compared during the sort.   See np.argsort
>> and np.lexsort for faster alternatives.
>
>
> But the keys could be as in `lexsort`.
>
> I am currently using `argsort`, but I can do so because
> I don't need a lexicographically determined sort order
> for the indexes.
>
>
> To close with a related question:
> what is the preferred idiom for a descending sort?

adding [::-1] just creates a new view, pretty low cost.

Josef


>
> Thanks,
> Alan
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to