Skip to content

Instantly share code, notes, and snippets.

@ItsCosmas
Created May 9, 2019 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ItsCosmas/bbd94c47f327f9b670fb8c3fb1e3ec36 to your computer and use it in GitHub Desktop.
Save ItsCosmas/bbd94c47f327f9b670fb8c3fb1e3ec36 to your computer and use it in GitHub Desktop.
# 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