Monkeypatch Example in Python

import m
def monkey_f(self):
print("monkey_f()")
m.MyClass.f = monkey_f
obj = m.MyClass()
obj.f()

Leave a Reply

Your email address will not be published. Required fields are marked *