Sollicitatievraag bij TensorIoT

What is moneky patching

Antwoord op sollicitatievraag

Anoniem

27 dec 2021

We can change the behavior of the code at run time (Dynamic modifications) is called monkey patching. # parent.py class A: def func_a(self): print ("func_a() is called") In another file where we will update the whole function as below import parent def monkey_func(self): print ("monkey_func() is called") parent.A.func_a = monkey_function obj = parent.A() obj.func_a() # o/p monkey_func() is called