Why are there no ordered dictionaries?

Alex Martelli aleax at mail.comcast.net
Wed Nov 23 01:05:27 EST 2005


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.


Alex



More information about the Python-list mailing list