Skip to content

Instantly share code, notes, and snippets.

@pcote
Last active March 26, 2017 16:56
Show Gist options
  • Save pcote/f4b2fb4eba25743c0d92f2fbf02009c4 to your computer and use it in GitHub Desktop.
Save pcote/f4b2fb4eba25743c0d92f2fbf02009c4 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))
def say_other_stuff(self):
print("New say_stuff says this: {}\n\n".format(self.msg))
MyClass.say_stuff = say_other_stuff
ob = MyClass("This is my message here")
ob.say_stuff()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment