Skip to content

Instantly share code, notes, and snippets.

@jself
Created February 27, 2013 17:02
Show Gist options
  • Save jself/5049551 to your computer and use it in GitHub Desktop.
Save jself/5049551 to your computer and use it in GitHub Desktop.
class A(object):
def printer(self, text):
print text
def wrapped(func):
def newprinter(self, text):
print "Here: %s"%text
return newprinter
A.printer = wrapped(A.printer)
a = A()
a.printer("Hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment