Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def logged(function):
- def wrapper(*args):
- result = function(*args)
- function_name_str = str(function.__name__)
- function_args = ", ".join(map(str, args))
- log_result = "you called " + function_name_str + "(" + function_args + ")" + '\n' + "it returned " + str(result)
- return log_result
- return wrapper
- @logged
- def func(*args):
- return 3 + len(args)
- print(func(4, 4, 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement