Skip to content

Instantly share code, notes, and snippets.

@fsword
Created November 22, 2013 05:50
Show Gist options
  • Save fsword/7595435 to your computer and use it in GitHub Desktop.
Save fsword/7595435 to your computer and use it in GitHub Desktop.
python decorate example
#!/usr/bin/env python
def dec(fn):
def inner_fn(*args):
result = fn(*args)
print "the result is: " + result
return result
return inner_fn
@dec
def hello():
print 'execute'
return 'hello'
hello()
def hello():
print 'execute'
return 'hello'
hello()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment