Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)
peter at engcorp.com
Sat Aug 6 19:26:55 CEST 2005
> seberino at spawar.navy.mil wrote:
> def enclosing():
> def enclosed():
> which is like saying python is not working
> It's ok to mark non locals,but why var=4 is not searched outside and
> var=4 yes?
Because "var=4" rebinds the name "var", while "var=4" does not. It's
exactly the same issue with using "global", where you don't need it if
you aren't rebinding the name.
(Those who don't understand the difference between "rebinding a name"
and "modifying an object" will need to figure out that distinction
before they can participate much in a discussion about Python scopes, I
More information about the Python-list