Why are there no ordered dictionaries?

Christoph Zwerschke cito at online.de
Sun Nov 27 06:09:29 EST 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 
slices, i.e.

- 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

-- Christoph



More information about the Python-list mailing list