Why are there no ordered dictionaries?

Tom Anderson twic at urchin.earth.li
Tue Nov 22 20:55:00 EST 2005


On Tue, 22 Nov 2005, Christoph Zwerschke wrote:

> Fuzzyman schrieb:
>
>> Of course ours is ordered *and* orderable ! You can explicitly alter 
>> the sequence attribute to change the ordering.
>
> What I actually wanted to say is that there may be a confusion between a 
> "sorted dictionary" (one where the keys are automatically sorted) and an 
> "ordered dictionary" (where the keys are not automatically ordered, but 
> have a certain order that is preserved). Those who suggested that the 
> "sorted" function would be helpful probably thought of a "sorted 
> dictionary" rather than an "ordered dictionary."

Exactly.

Python could also do with a sorted dict, like binary tree or something, 
but that's another story.

tom

-- 
When I see a man on a bicycle I have hope for the human race. --
H. G. Wells



More information about the Python-list mailing list