[Python-Dev] decorate-sort-undecorate
Guido van Rossum
guido at python.org
Wed Oct 15 12:02:12 EDT 2003
> > What about the situation where you want the list sorted in reverse order?
> > If you simply sort and then reverse the list you've broken the stability.
>
> Yes, that's the same thing Alex Martelli brought up. You could also
> supply a cmp function, as Geoffrey Talvola suggested (though this will
> make the comparisons more costly).
Oops. I misremembered Geoffrey's suggestion; he suggested two sorts
with a reverse() call in between. I think that would have the same
problem.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list