uni-repo/dekorator/beispiel2.py

21 lines
342 B
Python
Raw Normal View History

2025-03-29 12:32:35 +01:00
def my_decorator_with_args(surrounding_text):
def actual_decorator(func):
def wrapper():
print(surrounding_text)
func()
print(surrounding_text)
return wrapper
return actual_decorator
### use it:
@my_decorator_with_args('***')
def say_hello():
print("Hello!")
say_hello()