Terry J. Reedy <[EMAIL PROTECTED]> added the comment: Your example seem too verbose and diffuse. Perhaps something more focused on what people do wrong would be more helpful. I presume you mean something like this -- with or without x=2 before the def.
>>> def f(): print (x) x = 1 >>> f() Traceback (most recent call last): File "<pyshell#31>", line 1, in <module> f() File "<pyshell#30>", line 2, in f print (x) UnboundLocalError: local variable 'x' referenced before assignment What are the other ways people get the error. ---------- nosy: +tjreedy _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4246> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com