B
Bruno Desthuilliers
Pavel Skvazh a écrit :
Google for "monkey patch".
FWIW, what turns a function into a method is not the fact that it has
been defined with a class statement, but the fact that it's an attribute
of a class object. Where the function is defined is totally irrelevant.
Is it possible to override a class in the module or the module itself
that is imported across the project to add new methods to it?
For example I've got
module 'a' with class A
from a import A
but I don't want to add a method to that A class not just in this
unit, but across the project, so everywhere I'll import class A - it
would be a modified one.
Google for "monkey patch".
FWIW, what turns a function into a method is not the fact that it has
been defined with a class statement, but the fact that it's an attribute
of a class object. Where the function is defined is totally irrelevant.