What is monkey patching in Python?

Last updated 3 weeks, 5 days ago | 41 views 75     5

Tags:- Python

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 fun(self):

import m
def monkey(self):
    print "Hi, monkey"

m.A.func = monkey
a = m.A()
a.func()    #Hi, monkey