Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 8
    This is patching the class A, not the instance a. Commented Sep 24, 2011 at 20:04
  • 10
    Is there a reason to use setattr(A,'printme',printme) instead of simply A.printme = printme? Commented Aug 9, 2013 at 10:04
  • 4
    It makes sense if one constructs method name at runtime. Commented Apr 2, 2016 at 7:35