Is there such a thing as an ordered dict?

David Eppstein eppstein at ics.uci.edu
Fri May 10 10:28:12 EDT 2002


In article <m3offobj2w.fsf at mira.informatik.hu-berlin.de>,
 martin at v.loewis.de (Martin v. Loewis) wrote:

> Ask Google:
> 
> http://www.google.de/search?q=Python+ordered+dictionary
> 
> The first hit gives
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747

This orders the dictionary entries by their keys.
If you want to order entries by their values, my recipe
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117228
may be appropriate.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list