Q: sort's key and cmp parameters
hniksic at xemacs.org
Wed Oct 7 14:35:34 CEST 2009
Bearophile <bearophileHUGS at lycos.com> writes:
> 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.
Note that stable sort has additional memory requirements. In situations
where you don't need stability, but do need memory-efficient in-place
sorting, an unstable sort might well be preferred. This is why
libraries such as C++'s STL offer both.
More information about the Python-list