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