[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing dict to modify values

YANQ (Yet Another Newbie Question) ...

I would like to create a subclass of dict that modifies values as they
are inserted.  (Effectively I want to do the equivalent of "interning"
the values, although they aren't strings.)

Do I need to implement any methods other than __setitem__?  (I.e. will
any other methods/operators that add values to the dictionary call my
__setitem__ method?)

Ian Pilcher                                         arequipeno at gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------