Intro-to-Jinja-tpl-v2/hello_decorator.py

13 lines
294 B
Python
Raw Normal View History

2024-02-13 13:04:17 +00:00
def decorator(func):
def wrapper():
print("Something is happening before the function is called.")
func()
print("Something is happening after the function is called.")
return wrapper
@decorator
2024-02-13 13:04:17 +00:00
def say_whee():
print("Whee!")
say_whee = decorator(say_whee)