Monkey Patching

0 votes

What is monkey patching?

Jul 20, 2018 in Python by eatcodesleeprepeat
• 4,710 points
543 views

1 answer to this question.

0 votes

Dynamically modifying a class or module at run-time.

  1. >>> class A:

  2.   def func(self):

  3.       print("Hi")

  4. >>> def monkey(self):

  5. print "Hi, monkey"

  6. >>> m.A.func = monkey

  7. >>> a = m.A()

  8. >>> a.func()

Hi, monkey

answered Jul 20, 2018 by Priyaj
• 58,090 points

Related Questions In Python

0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,069 views
0 votes
1 answer
0 votes
1 answer

Linux Servers Patching - GCP

Yes, GCP currently lacks a product that ...READ MORE

answered Nov 4, 2022 in GCP by Tejashwini
• 3,820 points
480 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP