20 lines
313 B
Python
20 lines
313 B
Python
|
|
# Modifizieren Sie das folgende Beispiel so,
|
||
|
|
# dass die Python-Dekorator-Syntax mit dem
|
||
|
|
# @-Zeichen verwendet wird!
|
||
|
|
|
||
|
|
def my_decorator(func):
|
||
|
|
def wrapper():
|
||
|
|
print("Before")
|
||
|
|
func()
|
||
|
|
print("After")
|
||
|
|
return wrapper
|
||
|
|
|
||
|
|
@my_decorator
|
||
|
|
def say_hello():
|
||
|
|
print("hello world!")
|
||
|
|
|
||
|
|
|
||
|
|
say_hello()
|
||
|
|
|
||
|
|
|