+ 1

Why no output?

def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") print_text = decor(print_text) print_text()

16th May 2017, 5:55 PM
Uktam Khamidov
Uktam Khamidov - avatar
4 ответов
+ 7
Both codes should give the same output. Could you save the former and the latter to different SoloLearn entries and check?
16th May 2017, 7:46 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
And why this one has output??? _____________________________ def decor(func): def wrap(): print("============") func() print("============") return wrap @decor def print_text(): print("Hello world!") print_text();
16th May 2017, 5:59 PM
Uktam Khamidov
Uktam Khamidov - avatar
0
it's magic, now they both works, but yesterday the first one didn't
17th May 2017, 2:25 AM
Uktam Khamidov
Uktam Khamidov - avatar
0
I need help with a similar problem: text = input() def uppercase_decorator(func): def wrapper(t): #your code goes here t = t.upper() func(t) return wrapper @uppercase_decorator def display_text(text): return(text) print(display_text(text))
8th Apr 2021, 1:34 PM
redsnapper