__delitem__ "feature"

Ian Kelly ian.g.kelly at gmail.com
Sun Dec 26 13:10:27 EST 2010


On 12/26/2010 10:53 AM, kj wrote:
> P.S. If you uncomment the commented-out line, and comment out the
> last line of the __init__ method (which installs self._delitem as
> self.__delitem__) then *all* the deletion attempts invoke the
> __delitem__ method, and are therefore blocked.  FWIW.

Because subclasses of builtins only check the class __dict__ for special 
method overrides, not the instance __dict__.




More information about the Python-list mailing list