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.
2 Antworten
+ 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/
+ 1
Oh right thanks