Created
March 29, 2013 03:02
-
-
Save dandye/5268469 to your computer and use it in GitHub Desktop.
Decorator practice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_bold(fn): | |
def bold(): | |
return "<b>{}</b>".format(fn()) | |
return bold | |
def make_italic(fn): | |
def italic(): | |
return "<i>{}</i>".format(fn()) | |
return italic | |
@make_italic | |
@make_bold | |
def dec(): | |
return "Hello, World!" | |
print dec() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment