Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save valeria-aynbinder-edu/bb708f44f215bca78ee27d5cb2f0277b to your computer and use it in GitHub Desktop.
Save valeria-aynbinder-edu/bb708f44f215bca78ee27d5cb2f0277b to your computer and use it in GitHub Desktop.
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