Why are there no ordered dictionaries?

bonono at gmail.com bonono at gmail.com
Wed Nov 23 01:12:14 EST 2005


Alex Martelli wrote:
> bonono at gmail.com <bonono at gmail.com> wrote:
>    ...
> > But I can also record these changes in a seperate table which then
> > becomes a "sorted" case ?
>
> somedict['x']='y', per se, does no magic callback to let you record
> anything when type(somedict) is dict.  You can wrap or subclass to your
> heart's content to record insertion/deletion/update history, but that
> ever-changing "seperate [[sic]] table" is entirely coupled to
> 'somedict', not therefore "separate" at all, and should properly be kept
> as an instance variable of your wrapper or subclass.
>
> That's a pretty obvious difference from cases in which the auxiliary
> table used to define the ordering is REALLY *separate* -- independent of
> the insertion/etc history of the dictionaries it may be used on.
> 
So, it depends.




More information about the Python-list mailing list