[Python-Dev] "What's New": stable sorting?

Greg Ward gward at python.net
Sat Jul 24 03:33:49 CEST 2004

Just reading through "What's New in Python 2.4" and I spotted this:

The results of sorting are now guaranteed to be stable. This means that
two entries with equal keys will be returned in the same order as they
were input. For example, you can sort a list of people by name, and then
sort the list by age, resulting in a list sorted by age where people
with the same age are in name-sorted order.

I thought the Tim-bot fixed Python's list.sort() to be stable *aaaages*
ago -- 1.6 or 2.0 rings a bell.  Not true?

Greg Ward <gward at python.net>                         http://www.gerg.ca/
Police arrested two kids yesterday -- one was drinking battery acid,
the other was eating fireworks.  They charged one and let the other one off.

More information about the Python-Dev mailing list