Subclassing dict to modify values
Ian Pilcher
arequipeno at gmail.com
Wed Aug 2 18:26:59 EDT 2017
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" --------
========================================================================
More information about the Python-list
mailing list