Skip to content

Instantly share code, notes, and snippets.

@mebaysan
Created November 9, 2021 09:38
Show Gist options
  • Save mebaysan/cabafdbc34fd19c92bf14058fd0b2aab to your computer and use it in GitHub Desktop.
Save mebaysan/cabafdbc34fd19c92bf14058fd0b2aab to your computer and use it in GitHub Desktop.
Python Basic Decorator Template
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