Created
February 21, 2019 06:47
-
-
Save tritium21/e38ff55c3e3b1138da04c90bad7a7e8f 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
| import functools | |
| def debug(message="*** DEBUG"): | |
| def wrapper(func): | |
| @functools.wraps(func) | |
| def inner(*p, **kw): | |
| print(message) | |
| return func(*p, **kw) | |
| return inner | |
| return wrapper | |
| @debug("*** foo") | |
| def foo(a, b): | |
| return a + b | |
| print(foo(1, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment