Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Created January 23, 2021 15:48
Show Gist options
  • Save agusrichard/6dac541e6bfd6295d3b9d105cbbd2b35 to your computer and use it in GitHub Desktop.
Save agusrichard/6dac541e6bfd6295d3b9d105cbbd2b35 to your computer and use it in GitHub Desktop.
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