In which versions is list.sort stable?
Gerhard Häring
gh at ghaering.de
Mon Apr 28 20:42:54 EDT 2003
Frantisek Fuka wrote:
> Can you please explain to a newbie what this thread means?
>
> Should I not use SORT in Python 2.2.2? Docs do not mention anything
> about "unstability". Are there any other "bacis" functions (and SORT
> seems pretty basic to me) that I should avoid???
I didn't know what a "stable sort" is, either. So I looked it up:
http://www.wikipedia.org/wiki/Stable_sort
"""
A stable sort is a sort algorithm that does not change the relative
order of elements that have equal key values. This is important for some
algorithms (for example, radix sort).
"""
So it's not that Python's sort implementation is unstable in the sense
of broken :-)
HTH,
-- Gerhard
More information about the Python-list
mailing list