Why are there no ordered dictionaries?

Christoph Zwerschke cito at online.de
Tue Nov 22 16:06:12 EST 2005


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

Oops, sorry, that was nonsense again. I meant
d1[0:1] + d1[1:2] ==> OrderedDict( (1, 11), (3, 13) )

> Ordered dictionaries could allow slicing and concatenation.

Some operations such as concatenation need of course special 
considerations, since the keys must stay unique. A concatenation of 
ordered dicts with overlapping keys should probably give an IndexError.

-- Christoph



More information about the Python-list mailing list