2 ms·
You mean: def myfunc(): try: while x in someiterator(): a = x dosomethingwith(a) except: # Does a exist here or not? I
by bb88 8y ago
You mean:
def myfunc():
try:
while x in someiterator():
a = x
dosomethingwith(a)
except:
# Does a exist here or not?
If someiterator() raises then a won't exist in the function block. Otherwise it will.