0
Why is "return wrap" here? Python
def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) decorated()
2 Answers
+ 1
The function is returning the function wrap.
When you assign decor(print_text) to 'decorator', 'decorator' has value wrap. As 'decorator' has a function as you can call it.