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

Eric S. Raymond esr@thyrsus.com
Mon, 31 Jan 2000 22:25:01 -0500


Tim Peters <tim_one@email.msn.com>:
> > ...
> > The solution can be the same as what Algol used: 'if' outside
> > parentheses is a statement, and inside parentheses is an expression.
> > It's a bit of a grammar rearrangement, but totally unambiguous.
> 
> If I didn't know better <wink>, I'd say there's an actual consensus here:
> it seems we would all agree to "(if cond then true else false)" spelling.
> Not to be overlooked is Christian's enhancement, allowing "elif" too (beats
> all heck out of guessing how ?: nests!).
> 
> Eric, are you also in agreement?

I'm not sure.  I'm concerned that this syntax will actually be more 
viually confusing that ?:.  That having been said, I am more interested
in having ternary-select be in the language than I am in arguing about its 
exact syntax.
-- 
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

Men trained in arms from their infancy, and animated by the love of liberty,
will afford neither a cheap or easy conquest.
        -- From the Declaration of the Continental Congress, July 1775.