Skip to content

Instantly share code, notes, and snippets.

@trek
Created October 6, 2008 14:07
Show Gist options
  • Select an option

  • Save trek/15044 to your computer and use it in GitHub Desktop.

Select an option

Save trek/15044 to your computer and use it in GitHub Desktop.
class Foo(object):
def __init__(self,arg):
"""docstring for __init__"""
self.arg = arg
def dec(fn):
def wrapper(*args):
# args[0] is self. Lame
args[0].arg = 'not what you thought, huh?'
return fn(*args)
return wrapper
@dec
def bar(self):
"""docstring for bar"""
return self.arg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment