From 7bfa1bc9dae81795acff4b93356885c338c5c0fe Mon Sep 17 00:00:00 2001 From: fenix Date: Tue, 13 Feb 2024 14:30:23 +0100 Subject: [PATCH] decorator - Py iii <- pre function parameters --- decorators.py | 5 +++++ hello_decorator.py | 1 + 2 files changed, 6 insertions(+) create mode 100644 decorators.py diff --git a/decorators.py b/decorators.py new file mode 100644 index 0000000..0df6c8e --- /dev/null +++ b/decorators.py @@ -0,0 +1,5 @@ +def do_twice(func): + def wrapper_do_twice(): + func() + func() + return wrapper_do_twice diff --git a/hello_decorator.py b/hello_decorator.py index 0c792e5..869dbe2 100644 --- a/hello_decorator.py +++ b/hello_decorator.py @@ -5,6 +5,7 @@ def decorator(func): print("Something is happening after the function is called.") return wrapper +@decorator def say_whee(): print("Whee!")