I dont understand how decorators execute. Since the decorated function is being overwritten
For the following example
def get_text(name):
return "{0}".format(name)
def decorate(func):
def func_wrapper(name):
return "{0}".format(func(name))
return func_wrapper
When the following statement will be executed, get_text will be overwritten by what the decorator returns.
get_text = decorate(get_text)
Since get_text is overwritten. How can the original get_text function run inside the returned statement from the decorator. When I do the following
print get_text("John")