1.In Python, we can define a function inside another function.
2.In Python, a function can be passed as parameter to another function (a function can also return another function).
# can be defined inside another function and a
# function can be passed as parameter.
# Adds a welcome message to the string
def messageWithWelcome(str):
def addWelcome():
# and str.
return addWelcome() + str
def site(site_name):
We use @func_name to specify a decorator to be applied on another function.
# returned by fun(). Takes fun() as
# parameter and returns welcome().
def decorate_message(fun):
return addWelcome
def site(site_name):