Created
June 1, 2020 07:53
-
-
Save eclecticmiraclecat/789ddb6316a0317a0d832cc58350dbcb 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 boo_what(fmt): | |
... def boo(func): | |
... def wrapper(*args, **kwargs): | |
... print(f'BOO {fmt}') | |
... return func(*args, **kwargs) | |
... return wrapper | |
... return boo | |
... | |
>>> @boo_what('hello') | |
... def add(x, y): | |
... return x + y | |
... | |
>>> add(2,3) | |
BOO hello | |
5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment