Why are there no ordered dictionaries?

Bengt Richter bokr at oz.net
Tue Nov 22 12:22:02 EST 2005


On 22 Nov 2005 02:16:22 -0800, "Fuzzyman" <fuzzyman at gmail.com> wrote:

>
>Kay Schluehr wrote:
>> Christoph Zwerschke wrote:
>>
>> > That would be also biased (in favour of Python) by the fact that
>> > probably very little people would look for and use the package in the
>> > cheese shop if they were looking for ordered dicts.
>>
>> Does anyone actually use this site? While the Vaults offered a nice
>> place and a nice interface the Cheese Shop has the appeal of a code
>> slum.
>>
>
>Hmmm.. it's *the* repository for Python code. I expect quite a few
>people use it...
>
>:-)
>
I hadn't realized how much stuff was there. I generally google for stuff,
but I will be looking directly now.

BTW, I made a mod[1] to your odict that I think/hope is going to be generally faster.
It requires 2.4 though. It passes the same doctest, so its probably close to the same.
It stores the ordering info differently, but is also a dict subclass.

Do you happen to have a timing test that exercises various aspects, so I can try it
before I embarrass myself? Otherwise I guess I'll write something.

Would the would-be users chime in with some idea of what kinds of operations are
most important timing-wise? Which would get the most use? How dynamic would ordering typically be?

[1] fairly pervasive little mods actually
[ 9:15] C:\pywk\clp>diff    odict.py odictb.py |wc
        146        458       4948

[ 9:15] C:\pywk\clp>wc odict*.py
        467       1228      12483       odict.py
        511       1500      14728       odictb.py
        978       2728      27211       Totals

Regards,
Bengt Richter



More information about the Python-list mailing list