Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# USEFUL for extending functionality of functions you don't wanna modify
# this function takes a function as its parameter
def decorator(function):
def wrap():
print("Adding Printing Functionality")
function()
print("Adding Print Functionality")
return wrap
@decorator
def print_function():
print("Print by the print Function")
print_function()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment