Why are there no ordered dictionaries?

Carsten Haese carsten at uniqsys.com
Tue Nov 22 14:51:45 EST 2005


On Tue, 2005-11-22 at 14:37, Christoph Zwerschke wrote:
> In Foord/Larosa's odict, the keys are exposed as a public member which 
> also seems to be a bad idea ("If you alter the sequence list so that it 
> no longer reflects the contents of the dictionary, you have broken your 
> OrderedDict").

That could easily be fixed by making the sequence a "managed property"
whose setter raises a ValueError if you try to set it to something
that's not a permutation of what it was.

> d1[0] + d1[2] ==> OrderedDict( (1, 11), (3, 13) )

What do you think you're doing here?

-Carsten





More information about the Python-list mailing list