[Python-Dev] replacing 'global'

Alex Martelli aleaxit at yahoo.com
Mon Oct 27 12:20:14 EST 2003


On Monday 27 October 2003 06:08 pm, Neal Norwitz wrote:
> On Mon, Oct 27, 2003 at 08:51:16AM -0800, Guido van Rossum wrote:
> > The only problem with using :: is a syntactic ambiguity:
> >
> >   a[x::y]
> >
> > already means something (an extended slice with start=x, no stop, and
> > step=y).
>
> I'm not wedded to the :: digraph, I prefer the concept.  :: was nice
> because it re-used a similar concept from C++.  No other digraph jumps

Does it have to be a digraph?  We could use one of the ASCII chars
Python doesn't use.  For example, $ would give us exactly the same
way as Ruby to strop global variables (though, differently from Ruby,
we'd only _have_ to strop them on rebinding -- more-common "read"
accesses would stay clean) -- $variable meaning 'global'.  And
scope$variable meaning 'outer'.  OTOH, if we used @ instead,
it would read better the other way 'round -- variable at scope DOES
look like a pretty natural way to indicate "said variable at said scope" --
though it doesn't read quite as well _without_ a scope.


Alex




More information about the Python-Dev mailing list