This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients georg.brandl, robwolfe, terry.reedy
Date 2008-11-07.20:38:32
SpamBayes Score 1.0921747e-10
Marked as misclassified No
Message-id <[email protected]>
In-reply-to
Content
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.
History
Date User Action Args
2008-11-07 20:38:33terry.reedysetrecipients: + terry.reedy, georg.brandl, robwolfe
2008-11-07 20:38:33terry.reedysetmessageid: <[email protected]>
2008-11-07 20:38:32terry.reedylinkissue4246 messages
2008-11-07 20:38:32terry.reedycreate