21 lines
495 B
Python
21 lines
495 B
Python
def make_pretty(func):
|
|
# define the inner function
|
|
def inner():
|
|
# add some additional behavior to decorated function
|
|
print("Dies ist die innere Funktion.")
|
|
|
|
# call original function
|
|
func()
|
|
# return the inner function
|
|
return inner
|
|
|
|
# define ordinary function
|
|
def ordinary():
|
|
print("Dies ist die ordinary() Funktion.")
|
|
|
|
# decorate the ordinary function
|
|
decorated_func = make_pretty(ordinary)
|
|
|
|
# call the decorated function
|
|
decorated_func()
|