Python | Monkey Patching
In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time.
# m.py
class A:
def func(self):
print("Hi")
import m
def monkey(self):
print "Hi, monkey"
m.A.func = monkey
a = m.A()
a.func() #Hi, monkey