Skip to content

Instantly share code, notes, and snippets.

@pcote
Last active March 26, 2017 16:58
Show Gist options
  • Save pcote/27cf6dd537c77e0e08202c4100960ac5 to your computer and use it in GitHub Desktop.
Save pcote/27cf6dd537c77e0e08202c4100960ac5 to your computer and use it in GitHub Desktop.
class MyClass(object):
def __init__(self, msg):
self.msg = msg
def say_stuff(self):
print("Standard say stuff message: {}\n\n".format(self.msg))
ob = MyClass("Here is the original message")
def say_stuff():
m = "Thought I'd say something else, didn't you?"
print(m)
#setattr(ob, "say_stuff", say_stuff)
ob.__dict__["say_stuff"] = say_stuff
ob.say_stuff()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment