0

Decoraters Python Type Error

def logger(func): def wrapper(*args,**kwargs): print('Logged') func(*args,**kwargs) wrapper @logger def Verify(PIN): if PIN == 1: print("Purchase complete") else: return Verify(1) So this return NoneType object is not callable, confused.

14th Jul 2020, 11:18 PM
Prog
Prog - avatar
2 odpowiedzi
+ 3
You forgot to return the wrapper def logger(func): def wrapper(*args,**kwargs): print('Logged') func(*args,**kwargs) return wrapper # you just forgot the return keyword here @logger def Verify(PIN): if PIN == 1: print("Purchase complete") else: return Verify(1) https://realpython.com/primer-on-JUMP_LINK__&&__python__&&__JUMP_LINK-decorators/
14th Jul 2020, 11:30 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Oh right thanks
14th Jul 2020, 11:39 PM
Prog
Prog - avatar