Created
April 23, 2013 15:30
-
-
Save seantalts/5444568 to your computer and use it in GitHub Desktop.
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 greets(function): | |
... def greets_wrapper(*args, **kwargs): | |
... print "hi there, ", function | |
... return function(*args, **kwargs) | |
... return greets_wrapper | |
... | |
>>> @greets | |
... def add(num1, num2): | |
... return num1 + num2 | |
... | |
>>> add(1, 2) | |
hi there, <function add at 0x109da2aa0> | |
3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment