sorting on keys in a list of dicts

Jeff Shannon jeff at
Fri Jan 7 16:15:13 EST 2005

Nick Coghlan wrote:

> Jeff Shannon wrote:
>> I suppose that your version has the virtue that, if the sortkey value 
>> is equal, items retain the order that they were in the original list, 
>> whereas my version will sort them into an essentially arbitrary order. 
>>  Is there anything else that I'm missing here?
> Stability in sorting is a property not to be sneezed at [...]

Agreed.  I'd started typing before I realized that it'd provide a 
stable sort, which pretty much answered my own question, but decided 
to send it anyhow in case I'd missed anything else... :)

Jeff Shannon
Credit International

More information about the Python-list mailing list