Created
January 17, 2022 07:53
-
-
Save esenthil2018/3bf9ddd77eb84c89e84b421f34f0f687 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
| # This the first decorator | |
| def decon_first(fn): | |
| # The new function the decorator returns | |
| def wrapper(): | |
| # Insertion of some code before and after | |
| print('This is the first decorator') | |
| return fn() | |
| return wrapper | |
| # This the second decorator | |
| def decon_second(fn): | |
| # The new function the decorator returns | |
| def wrapper(): | |
| # Insertion of some code before and after | |
| print('This is the second decorator') | |
| return fn() | |
| return wrapper | |
| @decon_first | |
| @decon_second | |
| def orig_nested(): | |
| return 'Nested Decorators' | |
| orig_nested() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment