Why are there no ordered dictionaries?
cito at online.de
Mon Nov 21 02:02:36 CET 2005
Ben Finney wrote:
> Without an example, it's hard to know what you want to do and whether
> an ordered dictionary is the best way to do it.
I have indicated an example, discussed in more detail in another subthread.
>> There are already enough competing implementations.
> Have they been sufficiently shaken out to show a clearly superior
> version? Is any version sufficiently beneficial to write a PEP for its
> inclusion in the standard library?
At least it shows I'm not the only one who thinks ordered dictionaries
may be sometimes nice to have.
>> I simply wanted to ask why it is not available in the standard lib,
>> since I simply don't know
>> - has it not been demanded loud enough?
> Loud demands don't count for much. PEPs with popular working
> implementations do.
Sorry, I did not mean "loud enough" but "often enough". The same what
you are calling "popular."
>> - because nobody presented a satisfying implementation yet?
> I'm not sure what you mean by "satisfying".
You can take your own definition: "sufficiently shaken out", "working",
"popular", and "succifiently beneficial" and "proven (to the BDFL's
> Another possibility: ordered dictionaries are not needed when Python
> 2.4 has the 'sorted' builtin.
The 'sorted' function does not help in the case I have indicated, where
"I do not want the keys to be sorted alphabetically, but according to
some criteria which cannot be derived from the keys themselves."
More information about the Python-list