Pregunta de entrevista de TensorIoT

What is moneky patching

Respuesta de la entrevista

Anónimo

27 dic 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