Created
January 23, 2021 15:48
-
-
Save agusrichard/6dac541e6bfd6295d3b9d105cbbd2b35 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
def simple_decorator(func): | |
"""Takes function, modifies it and returns the wrapper""" | |
def wrapper(): | |
print("Before calling the function") | |
func() | |
print("After calling the function") | |
return wrapper | |
def say_hi(): | |
print("Hiiiii....") | |
say_hi = simple_decorator(say_hi) | |
say_hi() | |
# Returns: | |
# Before calling the function | |
# Hiiiii.... | |
# After calling the function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment