Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

Grant Edwards grant.b.edwards at gmail.com
Fri Mar 8 08:49:24 EST 2024


On 2024-03-07, Cameron Simpson via Python-list <python-list at python.org> wrote:

> Yes. Note that the "global" namespace is the module in which the 
> function is defined.

One might argue that "global" isn't a good choice for what to call the
scope in question, since it's not global. It's limited to that source
file. It doesn't make sense to me to call a binding "global", when
there can be multile different "global" bindings of the same name.

--
Grant






More information about the Python-list mailing list