Skip to content

Instantly share code, notes, and snippets.

View manuelinfosec's full-sized avatar
:octocat:
resolving merge conflicts

Manuel manuelinfosec

:octocat:
resolving merge conflicts
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manuelinfosec
manuelinfosec / notebook.ipynb
Last active September 6, 2022 04:04
ab0f5ae0b84bf83849cd55e4839dd508
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ingredients
@bread
def strange_sandwich(food='--ham--'):
print(food)
strange_sandwich()
# Outputs:
##tomatoes#
#</''''''\>
# --ham--
@bread
@ingredients
def sandwich(food="--ham--"):
print(food)
sandwich()
# Outputs:
#</''''''\>
# #tomatoes#
def bread(func):
def wrapper():
print("</''''''\>")
func()
print("<\______/>")
return wrapper
def ingredients(func):
def wrapper():
print("#tomatoes#")
another_stand_alone_function = my_shiny_new_decorator(another_stand_alone_function)
@my_shiny_new_decorator
def another_stand_alone_function():
print("Leave me alone")
another_stand_alone_function()
# Outputs:
# Before the function runs
# Leave me alone
# After the function runs
a_stand_alone_function = my_shiny_new_decorator(a_stand_alone_function)
a_stand_alone_function()
# Outputs:
# Before the function runs
# I am a stand alone function, don’t you dare modify me
# After the function runs
a_stand_alone_function_decorated = my_shiny_new_decorator(a_stand_alone_function)
a_stand_alone_function_decorated()
# Outputs:
# Before the function runs
# I am a stand alone function, don't you dare modify me
# After the function runs
def a_stand_alone_function():
print("I am a stand alone function, don’t you dare modify me")
a_stand_alone_function()
# Outputs: I am a stand alone function, don't you dare modify me