Skip to content

Instantly share code, notes, and snippets.

@esenthil2018
Created January 17, 2022 07:53
Show Gist options
  • Save esenthil2018/3bf9ddd77eb84c89e84b421f34f0f687 to your computer and use it in GitHub Desktop.
Save esenthil2018/3bf9ddd77eb84c89e84b421f34f0f687 to your computer and use it in GitHub Desktop.
# 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