An ordered dictionary for the Python library?

Tuomas tuomas.vesterinen at pp.inet.fi
Wed Sep 12 17:25:27 EDT 2007


Mark Summerfield wrote:
> I feel that Python lacks one useful data structure: an ordered
> dictionary.

Why it should be a dict. With it you can only maintain the order 
x1<x2<x3... But by definition the order only requires x1<=x2<=x3... 
There are many use cases where keys are not unique. I'd prefer a list 
implementation, which would maintain the user defined order (cmp, key). 
So you could map your objects with any order.

TV



More information about the Python-list mailing list