sorting on keys in a list of dicts

Nick Coghlan ncoghlan at iinet.net.au
Sat Jan 8 06:10:06 CET 2005


Jeff Shannon wrote:
> 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... :)

And it turns out we both missed the fact that it avoids comparing the 
dictionaries which could save a *lot* of number crunching (as well as making 
otherwise unsortable lists sortable).

So it's a good thing you did decide to send it :)

Cheers,
Nick.


-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list