Source Code:
(back to article)
def log(func): def wrapper(*args, **kwargs): print(f'Calling {func.__name__} with arguments {args} and keyword arguments {kwargs}') result = func(*args, **kwargs) print(f'{func.__name__} returned {result}') return result return wrapper @log def add(x, y): return x + y
Result:
Report an issue