Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def logged(function):
- def wrapper(*args):
- result = function(*args)
- log_result = f"you called {function.__name__}({", ".join(map(str, args))})\nit returned {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