[Python-Dev] replacing 'global'

Alex Martelli aleaxit at yahoo.com
Sat Oct 25 10:03:17 EDT 2003


On Wednesday 22 October 2003 07:07 pm, Dave Brueck wrote:
   ...
> > like a global variable.  I also don't think I want global variable
> > assignments to look like attribute assignments.
>
> Go easy on me for piping up here, but aren't they attribute assignments or
> at least used as such? After reading the other posts in this thread I

I entirely afree with this "user of Python" perspective, and I think it's a 
pity it's been ignored in the following discussion.

> and any distinction would seem arbitrary or artificial (consider, for

Yes!  If the compiler needs to be aware of global assignments (which IS
a good idea) we can do so by either introducing a new "operator keyword",
OR something like Barry's suggestion of "import __me__" with __me__ as
a magicname recognized by the compiler (hey, if it can recognize __future__
why not __me__?-).  But to the Python user, making things look similar
when their semantics and use ARE similar is a wonderful idea.

> example, that it is not an uncommon practice to write a module instead of a
> class if the class would be a singleton).

Indeed, that IS the officially recommended practice (and Guido emphasized
that in rather adamant words after he had recovered from the shock of
seeing the Borg nonpattern presented at a Python-UK session...:-).


Alex




More information about the Python-Dev mailing list