Message108309
This isn't a bug; it's by design.
Because there's an assignment to 'a' in the function 'y', 'a' is considered local to that function. (It doesn't matter where the assignment happens within the function; the presence of an assignment anywhere is enough to make 'a' local for the entirety of 'y'.)
This is described in the reference manual at:
http://docs.python.org/reference/executionmodel.html#naming-and-binding
See the paragraph beginning:
"If a name binding operation occurs anywhere within a code block, " |
|
Date |
User |
Action |
Args |
2010-06-21 19:52:42 | mark.dickinson | set | recipients:
+ mark.dickinson, Andreas Hofmeister |
2010-06-21 19:52:42 | mark.dickinson | set | messageid: <1277149962.03.0.875525034353.issue9049@psf.upfronthosting.co.za> |
2010-06-21 19:52:40 | mark.dickinson | link | issue9049 messages |
2010-06-21 19:52:40 | mark.dickinson | create | |
|