Why are there no ordered dictionaries?

Tom Anderson twic at urchin.earth.li
Mon Nov 21 14:02:00 EST 2005


On Sun, 20 Nov 2005, Alex Martelli wrote:

> Christoph Zwerschke <cito at online.de> wrote:
>
>> 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."
>
> Ah, but WHAT 'some criteria'?  There's the rub!  First insertion, last 
> insertion, last insertion that wasn't subsequently deleted, last 
> insertion that didn't change the corresponding value, or...???

All the requests for an ordered dictionary that i've seen on this group, 
and all the cases where i've needed on myself, want one which behaves like 
a list - order of first insertion, with no memory after deletion. Like the 
Larosa-Foord ordered dict.

Incidentally, can we call that the "Larosa-Foord ordered mapping"? Then it 
sounds like some kind of rocket science discrete mathematics stuff, which 
(a) is cool and (b) will make Perl programmers feel even more inadequate 
when faced with the towering intellectual might of Python. Them and their 
Scwartzian transform. Bah!

tom

-- 
Baby got a masterplan. A foolproof masterplan.



More information about the Python-list mailing list