I cannot override some of the built-in functions, such as '__setitem__', in Python2.7 (although the same thing happened in previous versions that I tested)
Although I know this is easy to do with a subclass, this is not what I want here, I need to be able to dynamically override these methods.
Apparently, when my class is a subclass of the object , the overridden method always ends the call to the original, but when my class is not <the object ', it works:
>>> def new_implementation(k, v): ... print 'New implementation' ...
For some reason, it seems that objects use several different resolution methods for these built-in functions.
This is mistake? Am I doing something wrong?
source share