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 ezio.melotti
Recipients Rodrigo.Ventura, ezio.melotti
Date 2011-05-06.22:57:14
SpamBayes Score 1.4396802e-06
Marked as misclassified No
Message-id <1304722635.56.0.418561755237.issue12023@psf.upfronthosting.co.za>
In-reply-to
Content
The reason is that in nok Python sees the assignment to a (a = 1) and determines that the 'a' variable is local to the scope of f, and since the assignment comes after the "if a:" and at that point 'a' has no value, an error is raised.
In ok there's no assignment to 'a', so Python assume that 'a' refers to the 'a' variable defined in the outer scope.
History
Date User Action Args
2011-05-06 22:57:15ezio.melottisetrecipients: + ezio.melotti, Rodrigo.Ventura
2011-05-06 22:57:15ezio.melottisetmessageid: <1304722635.56.0.418561755237.issue12023@psf.upfronthosting.co.za>
2011-05-06 22:57:14ezio.melottilinkissue12023 messages
2011-05-06 22:57:14ezio.melotticreate