0

What is the need of wrap here??

def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") print_text = decor(print_text) print_text() I have read many explanations but none were satisfactory.

20th Jun 2019, 5:53 PM
Akash
Akash - avatar
2 Antworten
0
It's just a way to put those lines before and after the text. It would be a lot more readable though if you just took it out though.
20th Jun 2019, 7:11 PM
Jackson O’Donnell
- 1
Jackson O’Donnell removing it results in error
21st Jun 2019, 5:19 PM
Akash
Akash - avatar