How to handle empty (none) tuple returned from python function -
i have function either returns tuple or none. how caller supposed handle condition?
def nontest(): return none x,y = nontest() traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: 'nonetype' object not iterable
eafp:
try: x,y = nontest() except typeerror: # none-thing here or pass
or without try-except:
res = nontest() if res none: .... else: x, y = res
Comments
Post a Comment