Reputation: 3764
What is the difference between dispatch and monkey patch?
Monkey patching is explained a bit here. numpy uses dispatch. A comparison with an example would be good, if there is a difference at all.
Upvotes: 1
Views: 212
Reputation: 149125
Monkey patching is about adding functions at run time to a class or object. Dispatching is about calling methods discovered at run-time on an object that already implements them. Monkey patching is common in dynamic languages like Python or Ruby and would be a pain in more static languages like C, Java or C++. But dispatching is (rather) easy to implement in static languages. The reason why it is used in numpy which internally uses C functions.
Upvotes: 1