
Skip Montanaro wrote:
Given that the global keyword or something like it is here to stay (being preferable over some attribute-style access) and that global variable writes needs to be known to the compiler for future efficiency reasons, I think we need to consider modifications of the current global statement. The best thing I've seen so far (I forget who proposed it) is
'global' vars [ 'in' named_scope ] ... This should be compatible with existing usage. The only problem I see is whether the named_scope needs to be known at compile time or if it can be deferred until run time.
How about (to abuse a keyword that's gone unmolested for too long) global foo from def to declare that foo refers a variable in a lexically enclosing function definition? This avoids to need to name a specific function (which IMHO is just a source of confusion over the semantics of strange cases) while still having some mnemonic value (foo "comes from" an enclosing function definition). jw