0

None type error

I tried decorated function in python 3.7.3 shell By using code def decor (func): def wrap( ): Print ("=========") func( ) Print ("=========") return wrap def text( ): print ("Ganesh") Decorated=decor(text) Decorated( ) But this shows typeerror: 'nonetype' in my system Can you suggest me what to do

18th May 2019, 8:30 AM
Ganesh Babu
Ganesh Babu - avatar
2 Antworten
+ 1
Thank you😁✌🏼
18th May 2019, 9:10 AM
Ganesh Babu
Ganesh Babu - avatar
0
def decor(func): def wrap(): print("=========") func() print("=========") return wrap def text(): print("Ganesh") Decorated = decor(text) Decorated() Note the indentation level of "return wrap". In your code, the inner function wrap() is never called
18th May 2019, 8:37 AM
Anna
Anna - avatar