Amaury Forgeot d'Arc <amaur...@gmail.com> added the comment: What fails here is the evaluation of "x", not the assignment!
You are right concerning the assignment, the outer definition has no effect at all. The very presence of "x = " in the function code turns x into a local variable for the whole function; so 'x + "a"' fails because the local variable has not value yet. Python, unlike Lisp, defines scopes lexically, not dynamically. There is no "previous" binding, but "local" or "outer" scopes. ---------- resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14891> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com