Public bug reported: # monkeyy.py class X: def func(self): print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below:
import monkeyy def monkey_f(self): print "monkey_f() is being called" # replacing address of “func” with “monkey_f” monkeyy.X.func = monkey_f obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() Visit here for in-depth knowledge: https://intellipaat.com/blog/tutorial /python-tutorial/ ** Affects: sikuli Importance: Undecided Status: New ** Tags: python pythontutorial ** Description changed: - # monkeyy.py - class X: - def func(self): - print "func() is being called" + # monkeyy.py + class X: + def func(self): + print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below: - import monkeyy - def monkey_f(self): - print "monkey_f() is being called" + import monkeyy + def monkey_f(self): + print "monkey_f() is being called" # replacing address of “func” with “monkey_f” - monkeyy.X.func = monkey_f - obj = monk.X() + monkeyy.X.func = monkey_f + obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() + + <a href="https://intellipaat.com/data-scientist-course- + training/">html</a> + + [markdown](https://intellipaat.com/data-scientist-course-training/) + + [url=https://intellipaat.com/data-scientist-course- + training/]bbcode[/url] ** Description changed: # monkeyy.py class X: def func(self): print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below: import monkeyy def monkey_f(self): print "monkey_f() is being called" # replacing address of “func” with “monkey_f” monkeyy.X.func = monkey_f obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() - <a href="https://intellipaat.com/data-scientist-course- - training/">html</a> - - [markdown](https://intellipaat.com/data-scientist-course-training/) - - [url=https://intellipaat.com/data-scientist-course- - training/]bbcode[/url] + Visit here for in-depth knowledge: intellipaat.com/blog/tutorial/python- + tutorial/ ** Description changed: # monkeyy.py class X: def func(self): print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below: import monkeyy def monkey_f(self): print "monkey_f() is being called" # replacing address of “func” with “monkey_f” monkeyy.X.func = monkey_f obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() - Visit here for in-depth knowledge: intellipaat.com/blog/tutorial/python- - tutorial/ + Visit here for in-depth knowledge: intellipaat.com/blog/tutorial/python-tutorial/ + <a href="https://intellipaat.com/data-scientist-course-training/">html</a> + + [markdown](https://intellipaat.com/data-scientist-course-training/) + + [url=https://intellipaat.com/data-scientist-course- + training/]bbcode[/url] ** Description changed: # monkeyy.py class X: def func(self): print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below: import monkeyy def monkey_f(self): print "monkey_f() is being called" # replacing address of “func” with “monkey_f” monkeyy.X.func = monkey_f obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() - Visit here for in-depth knowledge: intellipaat.com/blog/tutorial/python-tutorial/ - <a href="https://intellipaat.com/data-scientist-course-training/">html</a> - - [markdown](https://intellipaat.com/data-scientist-course-training/) - - [url=https://intellipaat.com/data-scientist-course- - training/]bbcode[/url] + Visit here for in-depth knowledge: https://intellipaat.com/blog/tutorial + /python-tutorial/ -- You received this bug notification because you are a member of Sikuli Drivers, which is subscribed to Sikuli. https://bugs.launchpad.net/bugs/1884204 Title: What is monkey patching in Python? Status in Sikuli: New Bug description: # monkeyy.py class X: def func(self): print "func() is being called" The above module (monkeyy) is used to change the behavior of a function at the runtime as shown below: import monkeyy def monkey_f(self): print "monkey_f() is being called" # replacing address of “func” with “monkey_f” monkeyy.X.func = monkey_f obj = monk.X() # calling function “func” whose address got replaced # with function “monkey_f()” obj.func() Visit here for in-depth knowledge: https://intellipaat.com/blog/tutorial/python-tutorial/ To manage notifications about this bug go to: https://bugs.launchpad.net/sikuli/+bug/1884204/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp