Last active
March 26, 2017 16:54
-
-
Save pcote/c46b9354d3a8e7c9dec584edc5273492 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass(object): | |
pass | |
ob = MyClass() | |
def say_stuff(self): | |
print("The say stuff message here is: {}\n\n".format(self.msg)) | |
setattr(MyClass, "say_stuff", say_stuff) | |
setattr(ob, "msg", "Patched in message for patched in class") | |
ob.say_stuff() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment