I have a problem with the transfer of variable \'insurance_mode\' by the decorator. I would do it by the following decorator statement:
@execute_complete_rese
Here is a slightly modified version of t.dubrownik's answer. Why?
So use @functools.wraps():
from functools import wraps
def decorator(argument):
def real_decorator(function):
@wraps(function)
def wrapper(*args, **kwargs):
funny_stuff()
something_with_argument(argument)
retval = function(*args, **kwargs)
more_funny_stuff()
return retval
return wrapper
return real_decorator