Created
November 9, 2021 09:38
-
-
Save mebaysan/cabafdbc34fd19c92bf14058fd0b2aab to your computer and use it in GitHub Desktop.
Python Basic Decorator Template
This file contains hidden or 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
from functools import wraps | |
def my_decorator(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print('Do something before the function call') | |
func(*args, **kwargs) | |
print('Do something after the function call') | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment