Concepts of closures and decorators:
Closure: An inner function is defined in an outer function, the inner function uses the temporary variables of the outer function, and the return value of the outer function is a reference to the inner function, which is called a closure
Decorator: A decorator is a closure
Examples of decorators:
def func1():
print("func1() called")
def decorator(f):
print("before f() called")
return f
f1 = decorator(func1)
f1()
f2 = decorator(func1)
f2() #When
we replace