Q: sort's key and cmp parameters

Bearophile bearophileHUGS at lycos.com
Wed Oct 7 13:31:14 CEST 2009

Paul Rubin:
> Bearophile:
> > sorting, and something that's surely not bug-prone. In such situation
> > having a 'key' argument is *better*. Such sort can be stable.
> Nothing stops comparison sorting from being stable.  Since the rest of
> your post seems premised on the opposite, I hope that clears things up
> for you.

When I have written that post I was partially unfocused, I am sorry.

What I meant is that a general sorting routine, even in D, is better
to be first of all flexible. So I think it's better for the D built-in
sort to be stable, because such extra invariant allows you to use the
sort in more situations.


More information about the Python-list mailing list