Created
April 29, 2013 06:46
-
-
Save sidchilling/5480081 to your computer and use it in GitHub Desktop.
How to use the decorator package to write decorators
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
from decorator import decorator | |
def my_decorator_wrapper(func, first_name, last_name): | |
print 'You passed me the args: %s, %s' %(first_name, last_name) | |
return func(first_name, last_name) | |
my_decorator_wrapper = decorator(my_decorator_wrapper) | |
@my_decorator_wrapper | |
def decorated_function(first_name, last_name): | |
print 'My name is %s %s' %(first_name, last_name) | |
decorated_function('Luna', 'Lovegood') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment