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)
1 Resposta
+ 1
You could get rid of the method wrap and return nothing.
https://code.sololearn.com/cBFT9h9coug0/?ref=app