Last active
September 6, 2022 02:22
-
-
Save manuelinfosec/7599947af52586e5c6b1170b2f25e97b 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 bread(func): | |
def wrapper(): | |
print("</''''''\>") | |
func() | |
print("<\______/>") | |
return wrapper | |
def ingredients(func): | |
def wrapper(): | |
print("#tomatoes#") | |
func() | |
print("~salad~") | |
return wrapper | |
def sandwich(food='--ham--'): | |
print(food) | |
sandwich() | |
# Outputs: --ham-- | |
sandwich = bread(ingredients(sandwich)) | |
# sandwich is now reference to the decorator | |
# instead of the `--ham` string. | |
sandwich() | |
# Outputs: | |
# </''''''\> | |
# #tomatoes# | |
# --ham-- | |
# ~salad~ | |
# <\______/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment