Why are there no ordered dictionaries?

Magnus Lycka lycka at carmen.se
Tue Nov 22 16:06:51 CET 2005

Christoph Zwerschke wrote:
> I still believe that the concept of an "ordered dictionary" ("behave 
> like dict, only keep the order of the keys") is intuitive and doesn't 
> give you so much scope for ambiguity. 

Sure. Others think so too. The problem is that if you and these other
people actually write down exactly how this unambigous ordered dict
should behave, you'll end up with a dozen different sets of semantics,
which can be divided in at least three main groups.

People use different idioms, and often gather collections of classes
and functions that fit their style of coding and their typical problem
domains. There is nothing wrong with that, and they might well be made
publically available if they are more generally useful.

When adding things to the standard library, there are some more things
to consider, particularly for something general such as an odict class:
Is is general enough, and does it add enough value to outweigh the
increased cognitive burden of more classes/functions/types in the

For a beginner, it's easy to believe that things would be easier if
the tool you use had already solved the problem you have at hand for
you, but it turns out that the world has so many problems, that you
would end up with a impenetrable forest of standard library modules
if we actually tried to achieve this.

More information about the Python-list mailing list