[Python-Dev] Alternate notation for global variable assignments

Alex Martelli aleaxit at yahoo.com
Mon Oct 27 18:07:33 EST 2003

On Monday 27 October 2003 11:55 pm, Zack Weinberg wrote:
> Somewhat warty suggestion: take lst[:var] to be a slice, but
> lst[(:var)] to be a global variable reference.  And lst[:(:var)] to be
> a slice on a global, etc. etc.

That would work -- and with the :: (rather than single :) stropping
which Guido seems to prefer, too.  As long as ::name or
scope::name are always (parenthesized) when not doing so
would be ambiguous (same general rules as, say, for tuples),
which in their case would seem to be "within brackets only",
I think :: stropping would work fine -- and perhaps avoid some
possible single-: ambiguity in dictionary display such as

d = { a:b:c }

which would require further parenthesization -- with :: stropping,

d = { a::b:c }


d = { a:b::c }

are unambiguous, although parentheses would no doubt be
advisable anyway to help human readers.


More information about the Python-Dev mailing list