0

What is the use of "wrap" function?

Why does the following code come out with an "Nonetype"error? def decor(func): print("============") func() print("============") def print_text(): print("Hello world!") print_text = decor(print_text) print_text();

1st Aug 2016, 8:33 AM
Katze2333
Katze2333 - avatar
1 Resposta
+ 1
print_text == None, because decor() returns None. try: def decor(f): #.... @decor def print_text(): #... print_text() or: def decor(func): def s(): print('....') func() print('....') return s def print_text(): #.... print_text=decor(print_text) print_text()
1st Aug 2016, 10:15 AM
aruluth
aruluth - avatar