Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)
Bengt Richter
bokr at oz.net
Tue Aug 16 13:26:58 EDT 2005
On 5 Aug 2005 21:22:41 -0700, "seberino at spawar.navy.mil" <seberino at spawar.navy.mil> wrote:
>I'm not saying 'modulescope' and 'module' are the only alternatives or
>even
>the best anyone can come up with.
>
>'global' has the connotation of being visible *EVERYWHERE*
>where in Python it is just visible in one module's space.
One way is to spell this with a dotted name (e.g., "shared" or "SHARED_GLOBALS")
and use a module dedicated for this purpose, e.g.,
import SHARED_GLOBALS
def foo():
SHARED_GLOBALS.x = 'shared x may be (re)bound from anywhere'
>
>Can you think of a better alternative or do you believe
>'global' is the best possible?
>
I don't think 'global' would be best if we were starting out with
the name spaces we have now, but as you know it effectively means 'modulescope'
and derives from a time where that was the only unqualified alternative
to local.
There's been a lot of discussion about this, periodically ;-)
Regards,
Bengt Richter
More information about the Python-list
mailing list