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 mark.dickinson
Recipients Andreas Hofmeister, mark.dickinson
Date 2010-06-21.19:52:40
SpamBayes Score 0.0014038152
Marked as misclassified No
Message-id <1277149962.03.0.875525034353.issue9049@psf.upfronthosting.co.za>
In-reply-to
Content
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, "
History
Date User Action Args
2010-06-21 19:52:42mark.dickinsonsetrecipients: + mark.dickinson, Andreas Hofmeister
2010-06-21 19:52:42mark.dickinsonsetmessageid: <1277149962.03.0.875525034353.issue9049@psf.upfronthosting.co.za>
2010-06-21 19:52:40mark.dickinsonlinkissue9049 messages
2010-06-21 19:52:40mark.dickinsoncreate