You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code produces UnboundLocalError: local variable 'a' referenced before assignment, but pyflakes shows now errors.
The reason this code raises an exception is that local variables are determined statically at compile time, not at runtime, so the a = 2 line forces a to be function local inside of test. The del a does not make it global again (it is impossible to "make a local variable global again").
The text was updated successfully, but these errors were encountered:
The code produces
UnboundLocalError: local variable 'a' referenced before assignment
, but pyflakes shows now errors.The reason this code raises an exception is that local variables are determined statically at compile time, not at runtime, so the
a = 2
line forcesa
to be function local inside oftest
. Thedel a
does not make it global again (it is impossible to "make a local variable global again").The text was updated successfully, but these errors were encountered: