Last active
March 12, 2022 17:00
-
-
Save valeria-aynbinder-edu/bb708f44f215bca78ee27d5cb2f0277b 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 greeting_decorator(other_func): | |
# Note usage of *args, **kwargs | |
def greeting_func(*args, **kwargs): | |
print(f"\n---------------------------------------\n" | |
f"Hello!\nWelcome to function {other_func.__name__}!\n" | |
f"---------------------------------------\n") | |
# Calling the function with all the parameters sent | |
result = other_func(*args, **kwargs) | |
print(f"\n---------------------------------------\n" | |
f"Good-bye!\nThanks for using function {other_func.__name__}!" | |
f"\n---------------------------------------\n") | |
# Note: greeting_func returns a value! | |
return result | |
return greeting_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment