Why are there no ordered dictionaries?
cito at online.de
Sun Nov 27 12:09:29 CET 2005
Christoph Zwerschke wrote:
> I will assume that d has is a Foord/Larosa ordered dict with "sequence"
> attribute in the following.
> Then, with other words,
> d.keys[:] = newkeyseq
> should do the same as:
> d.sequence = newkeyseq
At least in the case where newkeyseq is a permutation of d.sequence.
Otherwise, it should behave like the given implementation for setting
- if newkeyseq has duplicate elements, an exception should be raised.
- if newkeyseq has elements not in d.sequence, then the dictionary
should be updated with corresponding None values
- if d.sequence has elements not in newkeyseq then these elements should
be deleted from the dictionary
More information about the Python-list