Python | What are decorators
A decorator in Python is a function that modifies the behavior of an existing function or class without any modification to the original source code.
A decorator takes another function as its argument and returns yet another function. They are represented @decorator_name in Python and are called in a bottom-up fashion.
# decorator function to convert to uppercase
def decor(func):
def wrapper(s):
s = s.upper()
return(func(s))
return inner
@decor
def check(s):
print(s)
check('Hello Python') # HELLO PYTHON