Open SylvainDe opened 8 years ago
Suggestion:
@register_suggestion_for(NameError, re.VARREFBEFOREASSIGN_RE)
def suggest_local_var_ref_before_assign(value, frame, groups):
"""Get the suggestions for local var reference before assign."""
del value # unused param
name, = groups
objs = get_objects_in_frame(frame).get(name, [])
for obj, scope in objs:
# TODO_ENCLOSING: suggest 'nonlocal'
if scope == 'global':
return
yield quote('global ' + name)
Got add different error message
NameError: free variable 'title' referenced before assignment in enclosing scope
$ python --version Python 3.2.3