[issue34291] UnboundLocalError raised on call to global

Tim Peters report at bugs.python.org
Tue Jul 31 10:13:13 EDT 2018


Tim Peters <tim at python.org> added the comment:

Yes, the assignment does "hide the global definition of g".  But this determination is made at compile time, not at run time:  an assignment to `g` _anywhere_ inside `f()` makes _every_ appearance of `g` within `f()` local to `f`.

----------
nosy: +tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34291>
_______________________________________


More information about the Python-bugs-list mailing list