Dictionary that adds items to itself

gyromagnetic gyromagnetic at excite.com
Thu Apr 25 12:09:27 EDT 2002


Hi,
I would appreciate some advice on the following. I would like to
create a dictionary-like object with the same properties as a normal
dictionary except with regard to adding items. When items are added, I
would like them to be processed by a function that may generate
additional items. I would like these additional items to be added to
the dictionary, have the function applied to them, have the resulting
items added to the dictionary, etc.

Can this be done by subclassing UserDict? Is there another way?

I am using Python2.1.3.

Thanks.

-gyro



More information about the Python-list mailing list