[Python-Dev] Alternate notation for global variable assignments
Phillip J. Eby
pje at telecommunity.com
Tue Oct 28 08:46:08 EST 2003
At 10:31 AM 10/28/03 +0100, Alex Martelli wrote:
>On Tuesday 28 October 2003 01:11 am, Barry Warsaw wrote:
> > What I really want is access to a namespace, and then all the normal
> > Python attribute access notations just work. They're one honking great
> > idea after all.
>Yes, all in all this does remain my preference, too. I'd take stropping (or
>"keyword stropping" a la Greg's "outer x") rather than declarative stuff,
>but just getting a namespace (in ways the compiler could recognize,
>i.e. by magicnames such as __me__) and then using __me__.x=23
>would require no new syntax and be maximally obvious. Sigh.
Why not just:
whatevermynameis.foo = bar
This would be even *more* maximally obvious, as you wouldn't need to know
what '__me__' means. :) And how often do you write a module without
knowing what its name is, or change the name after you've written
it? Plus, thanks to the time machine, it already works. :)
Heck, now that I've thought of it, I'm almost tempted to go change all my
existing uses of global to this instead...
More information about the Python-Dev