[issue13827] Unexecuted import changes namespace

Michael Foord report at bugs.python.org
Thu Jan 19 17:07:00 CET 2012


Michael Foord <michael at voidspace.org.uk> added the comment:

hippmr: the problem is that by importing SOMETHING inside that function you're creating a *local variable* called SOMETHING. If the override isn't executed, and SOMETHING isn't global, then that local variable doesn't exist - which is why you get that error.

So even if the import isn't executed, its existence in the function tells Python that name is local to the function.

----------
nosy: +michael.foord
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13827>
_______________________________________


More information about the Python-bugs-list mailing list