Sorted dictionary

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Thu Jan 21 01:54:35 EST 2010


On Wed, 20 Jan 2010 22:21:22 -0800, Dennis Lee Bieber wrote:

> On Thu, 21 Jan 2010 02:02:02 +0100, "Jan Kaliszewski"
> <zuo at chopin.edu.pl> declaimed the following in
> gmane.comp.python.general:
> 
>> Hello,
>> 
>> Inspired by some my needs as well as some discussions in the net, I've
>> implemented a sorted dictionary (i.e. a dict that returns keys, values
>> and items always sorted by keys):
>> 
> 	How does this differ from all the other "ordered dictionary" 
> schemes out there (and maybe even included in 2.7? I'm still on 2.5)


Ordered dicts remember the insertion order of keys.

Sorted dicts return the keys in sorted order.




-- 
Steven



More information about the Python-list mailing list