Author ezio.melotti
Recipients Rodrigo.Ventura, ezio.melotti
Date 2011-05-06.22:57:14
SpamBayes Score 1.43968e-06
Marked as misclassified No
Message-id <>
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.
Date User Action Args
2011-05-06 22:57:15ezio.melottisetrecipients: + ezio.melotti, Rodrigo.Ventura
2011-05-06 22:57:15ezio.melottisetmessageid: <>
2011-05-06 22:57:14ezio.melottilinkissue12023 messages
2011-05-06 22:57:14ezio.melotticreate