What is monkey patching?

前端 未结 8 2055
[愿得一人]
[愿得一人] 2020-11-21 16:35

I am trying to understand, what is monkey patching or a monkey patch?

Is that something like methods/operators overloading or delegating?

Does it have anyt

8条回答
  •  故里飘歌
    2020-11-21 17:01

    First: monkey patching is an evil hack (in my opinion).

    It is often used to replace a method on the module or class level with a custom implementation.

    The most common usecase is adding a workaround for a bug in a module or class when you can't replace the original code. In this case you replace the "wrong" code through monkey patching with an implementation inside your own module/package.

提交回复
热议问题