Last active
August 29, 2015 14:08
-
-
Save kvendrik/11d0c319ed383e9c8300 to your computer and use it in GitHub Desktop.
Just a simple decorators example
This file contains 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 makeAwesome(sayFunc): | |
def wrapper(*args): | |
print sayFunc(args[0]+" are awesome") | |
return wrapper | |
@makeAwesome | |
def say(name): | |
print name | |
""" | |
Equal to: makeAwesome(say), this returns wrapper. | |
So a call to say is actually wrapper(name) | |
""" | |
say("You") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment