Skip to content

Instantly share code, notes, and snippets.

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