Question #213

What is a monkey patch?

A monkey patch is piece of Python code which extends or modifies other code at runtime. It It allows to modify or extend the behavior of libraries, modules, classes or methods at runtime without actually modifying the source code which can be useful in some situations. For instance:

from SomeOtherProduct.SomeModule import SomeClass
def speak(self):
    return "ook ook eee eee eee!"
SomeClass.speak = speak

. (medium.com/@chipiga86/python-monkey-patching-like-a-boss-...)


Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵