Created
December 10, 2013 13:19
-
-
Save adrian-castravete/7890450 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
In [15]: def dec1(func): | |
...: @wraps(func) | |
...: def wrapper(*args, **kwargs): | |
...: largs = list(args) | |
...: largs.append('dec1') | |
...: args = tuple(largs) | |
...: return func(*args, **kwargs) | |
...: return wrapper | |
In [16]: def dec2(func): | |
...: @wraps(func) | |
...: def wrapper(*args, **kwargs): | |
...: largs = list(args) | |
...: largs.append('dec2') | |
...: args = tuple(largs) | |
...: return func(*args, **kwargs) | |
...: return wrapper | |
In [17]: @dec1 | |
...: @dec2 | |
...: def some_func(some_val, arg1, arg2): | |
...: print some_val, arg1, arg2 | |
In [18]: some_func('value') | |
value dec1 dec2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment