sorting on keys in a list of dicts

Tim Peters tim.peters at gmail.com
Fri Jan 7 12:31:46 EST 2005


[Nick Coghlan]
...
> Python 2.3 has a stable sort, and Python 2.4 brought the guarantee that it shall
> remain that way. I'm not sure about Python 2.2 and earlier.

No list.sort() implementation before 2.3 was stable.  It was
confusing, though, because the samplesort/binary_insertion_sort hybrid
Python used for the 4 years preceding 2.3 *was* stable for all "small
enough" lists.  More than one person got fooled by guessing that
stability observed in small test cases meant it was always stable.



More information about the Python-list mailing list