0

Why we don't call decor directly?

def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello") Decorated=decor(print_text) Decorated() The above code gives output while the below one dosen't. def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello") decor(print_text)

2nd Jul 2019, 7:59 AM
Dee Pan Kar
Dee Pan Kar - avatar
1 Answer
+ 1
You could get rid of the method wrap and return nothing. https://code.sololearn.com/cBFT9h9coug0/?ref=app
28th Jul 2019, 7:15 AM
androidCoder255
androidCoder255 - avatar