Last active
October 30, 2020 01:17
-
-
Save r3dm1ke/d2325c3f9ef5fae3f96ffa05fc1e6f90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
sum(2, 5) | |
> Before sum | |
> 7 | |
> After sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment