Skip to content

Instantly share code, notes, and snippets.

@esenthil2018
Created January 15, 2022 21:23
Show Gist options
  • Save esenthil2018/ad2e21a9507baa9133c7e70bbd2fc73c to your computer and use it in GitHub Desktop.
Save esenthil2018/ad2e21a9507baa9133c7e70bbd2fc73c to your computer and use it in GitHub Desktop.
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