Skip to content

Instantly share code, notes, and snippets.

@neilmock
Created March 27, 2009 00:59
Show Gist options
  • Save neilmock/86478 to your computer and use it in GitHub Desktop.
Save neilmock/86478 to your computer and use it in GitHub Desktop.
def teh_decorator(func):
def wrapped(*args, **kwargs):
if len(args) > 0:
func.new_thing = args[0]
return func(**kwargs)
return wrapped
@teh_decorator
def testmeyo():
pass
# so how do i get "new_thing" attribute to print?
if __name__=='__main__':
testmeyo("should_be_value_of_new_thing")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment