Skip to content

Instantly share code, notes, and snippets.

@Linus-Albertus
Created June 15, 2019 20:40
Show Gist options
  • Save Linus-Albertus/3d5080b2c0b1a43865a23ab7fd92e949 to your computer and use it in GitHub Desktop.
Save Linus-Albertus/3d5080b2c0b1a43865a23ab7fd92e949 to your computer and use it in GitHub Desktop.
[python decorator] An example of a Python decorator #python #decorator
def decorator(inner_function):
def wrapper(*args, **kwargs):
# New wrapper stuff
inner_function(*args, **kwargs)
# New wrapper stuff
return inner_function(*args, **kwargs)
return wrapper
@decorator
def decorated_function():
pass
decorated_function() # returns the decorated_function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment