decorator - Py iii <- pre function parameters

This commit is contained in:
fenix 2024-02-13 14:30:23 +01:00
parent 11acf9073d
commit 7bfa1bc9da
2 changed files with 6 additions and 0 deletions

5
decorators.py Normal file
View File

@ -0,0 +1,5 @@
def do_twice(func):
def wrapper_do_twice():
func()
func()
return wrapper_do_twice

View File

@ -5,6 +5,7 @@ def decorator(func):
print("Something is happening after the function is called.") print("Something is happening after the function is called.")
return wrapper return wrapper
@decorator
def say_whee(): def say_whee():
print("Whee!") print("Whee!")