Created
May 9, 2019 09:00
-
-
Save ItsCosmas/bbd94c47f327f9b670fb8c3fb1e3ec36 to your computer and use it in GitHub Desktop.
This file contains 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
# 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