Skip to content

Instantly share code, notes, and snippets.

@paltman
Forked from neilmock/gist:86478
Created March 27, 2009 02:19
Show Gist options
  • Save paltman/86496 to your computer and use it in GitHub Desktop.
Save paltman/86496 to your computer and use it in GitHub Desktop.
class kewlness(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
if len(args) > 0:
self.new_thing = args[0]
return self.func(*args, **kwargs)
def __repr__(self):
return self.func.__doc__
@kewlness
def testmeyo(*args):
pass
# so how do i get "new_thing" attribute to print?
if __name__=='__main__':
testmeyo("should_be_value_of_new_thing")
print testmeyo.new_thing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment