Created
January 17, 2022 07:48
-
-
Save esenthil2018/9d6cc8c1c5c3e8b4a2b83fc482adda99 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 decor_func(fn): | |
| def wrapper_func(*args,**kwargs): | |
| """ | |
| This is the wrapper function | |
| """ | |
| print('Execute this code before the main function is executed') | |
| return fn(*args, **kwargs) | |
| #Assign the original function name and the docstring to the wrapper name and doctstring. | |
| wrapper_func.__name__ = fn.__name__ | |
| wrapper_func.__doc__ = fn.__doc__ | |
| return wrapper_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment