[Python-Dev] Adding C ternary select (a?b:c) to Python?

Guido van Rossum guido@CNRI.Reston.VA.US
Sun, 30 Jan 2000 11:40:32 -0500


> Jim Fulton <jim@digicool.com>:
> > I'm surprised that using the colon doesn't cause problems.

[ESR] 
> Pgen doesn't tag this ambiguous.  The LL(1) traversal actually helps
> here; by the time you see a colon, you already know whether or not you're
> parsing a ternary telect.

Interestingly, the very ad-hoc parsing that I described in the
compiling/parsing session on devday would be hit by this...  I was
looking for a colon at nesting level zero.  Serves me right for not
using a real parse :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)