Skip to content

Instantly share code, notes, and snippets.

@Jay-flow
Created September 10, 2020 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jay-flow/c1f7707e84e5bc783380e797af4a7464 to your computer and use it in GitHub Desktop.
Save Jay-flow/c1f7707e84e5bc783380e797af4a7464 to your computer and use it in GitHub Desktop.
Decorator example code
def decorator_function(original_function):
def add_espresso():
print("Add espresso")
return original_function()
return add_espresso
@decorator_function
def add_water():
print("Add Water")
@decorator_function
def add_milk():
print("Add Milk")
print("# Americano Recipe")
add_water()
print("# Latte Recipe")
add_milk()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment