Mark Dickinson <dicki...@gmail.com> added the comment:

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, "

----------
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9049>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to