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
In my instance, I decided to solve this via a one-line lambda to create a new decorator function:
def finished_message(function, message="Finished!"):
def wrapper(*args, **kwargs):
output = function(*args,**kwargs)
print(message)
return output
return wrapper
@finished_message
def func():
pass
my_finished_message = lambda f: finished_message(f, "All Done!")
@my_finished_message
def my_func():
pass
if __name__ == '__main__':
func()
my_func()
When executed, this prints:
Finished!
All Done!
Perhaps not as extensible as other solutions, but worked for me.