Message135381
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:15 | ezio.melotti | set | recipients:
+ ezio.melotti, Rodrigo.Ventura |
2011-05-06 22:57:15 | ezio.melotti | set | messageid: <1304722635.56.0.418561755237.issue12023@psf.upfronthosting.co.za> |
2011-05-06 22:57:14 | ezio.melotti | link | issue12023 messages |
2011-05-06 22:57:14 | ezio.melotti | create | |
|