>>> class test:
def A(self, x, y):
return x+y
>>> t = test()
>>> t.A(10,20)
30
>>>
>>> def B(self, x, y):
return x*y
>>> test.A = B
>>> t.A(10,20)
200
>>>
Monkey-patching is the technique of swapping functions or methods with others in order to change a module, library or class behavior.