Python Decortors - Small question
we have the code ..................................................... def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) decorated() .............................................................. that's cool and I understand that completely, but why did i put another function (wrap) i think it's just a waste of time, couldn't I type this code... ........................................................... def decor(func): print("============") func() print("============") def print_text(): print("Hello world!") decor(print_text) .................................................................. basically, i called the function 'print_text' inside the function 'decor', isn't that easier??