Why are there no ordered dictionaries?

Christoph Zwerschke cito at online.de
Wed Nov 23 15:49:28 EST 2005


Alex Martelli wrote:

> However, since Christoph himself just misclassified C++'s std::map as
> "ordered" (it would be "sorted" in this new terminology he's now
> introducing), it seems obvious that the terminological confusion is
> rife.  Many requests and offers in the past for "ordered dictionaries"
> (e.g. on this group) were also "sorted", NOT "ordered", in this new
> terminology.

I'm sorry again. Please don't conclude that others are as uneducated as 
I am (I haven't studied computer science but mathematics). Speaking 
about "ordered" and "sorted" in the context of collections is not a new 
terminology I am introducing, but seems to be pretty common in computer 
science (see, e.g. 
http://www.gamespp.com/java/dataStructuresInJavaPart6.html).

Perhaps Pythonists are not used to that terminology, since they use the 
term "list" for an "ordered collection". An ordered dictionary is a 
dictionary whose keys are a (unique) list. Sometimes it is also called a 
"sequence" (therefore in the odict implementation, the keys attribute 
has this name). A unique list, in turn, can also be called an "ordered 
set", so you can also understand an ordered dictionary as a dictionary 
whose keys are an ordered set. I think all of this is pretty logical ;-)

-- Christoph



More information about the Python-list mailing list