3 ms·
I am surprised nobody mentioned python's weird scoping rules for local variables. It bit me countless times.
by chombier 8y ago
I am surprised nobody mentioned python's weird scoping rules for local variables. It bit me countless times.
- bb88 8y agoYou 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.