Created
January 23, 2021 16:01
-
-
Save agusrichard/2da3437e96523f4e29ccc5a2dd50fc24 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 | |
@simple_decorator | |
def say_ho(): | |
print("Hoo?") | |
say_ho() | |
# Returns | |
# Before calling the function | |
# Hoo? | |
# After calling the function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment