Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
r3dm1ke / main.py
Last active October 30, 2020 01:17
def logging_decorator(func):
def logging_wrapper(*args, **kwargs):
print(f'Before {func.__name__}')
func(*args, **kwargs)
print(f'After {func.__name__}')
return logging_wrapper
@logging_decorator
def sum(x, y):
print(x + y)
>>> def f(*, a, b):
... print(a, b)
...
>>> f(1, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() takes 0 positional
arguments but 2 were given
>>> f(a=1, b=2)
1 2