Skip to content

Instantly share code, notes, and snippets.

@cmertayak
Created February 23, 2014 21:40
Show Gist options
  • Save cmertayak/9177700 to your computer and use it in GitHub Desktop.
Save cmertayak/9177700 to your computer and use it in GitHub Desktop.
Python Decorator Example
def makebold(fn):
def wrapped():
return "<b>%s</b>" % fn()
return wrapped
def makeitalic(fn):
def cover():
return "<i>%s</i>" %fn()
return cover
@makeitalic
@makebold
def hello():
return "Hello World"
print hello()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment