Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)
apardon at forel.vub.ac.be
Tue Aug 16 11:54:53 CEST 2005
Op 2005-08-06, Peter Hansen schreef <peter at engcorp.com>:
> Paolino wrote:
>> 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.
This doesn't answer the question at the appropiate level IMO.
Why has one made a difference in search policy for finding a
variable based on whether the variable is rebound or not
in the first place.
More information about the Python-list