Conditional expressions (again)

Michael Abbott michael at rcp.co.uk
Thu Oct 25 09:39:01 EDT 2001


"Steve Holden" <sholden at holdenweb.com> wrote in
news:CpSB7.27304$Nx2.513851 at atlpnn01.usenetserver.com: 

> What we are currently missing is *agreement* - both on whether it's
> really useful and, more especially, on what the syntax should be.

Sorry to keep banging on about this one.

Well, I don't really think there's a great deal of argument about the 
syntax.  There are, as far as I'm aware, two live proposals for syntax:

(1)    	x = if a: b elif c: d else: e
or
(2)    	x = if a then b elif c then d else e

I seem to recall that Guido stated that he'd had a go at implementing 
syntax 2 (which I prefer if we're willing to pay the price of a new keyword 
'then'), and that it worked well enough with the Python syntax.

The main argument, really, seems to be about whether this is useful.  If we 
agreed on this then sorting out the syntax would be easy: go for (2) and 
choose a sensible precendence (in particular, is 
    	if 1 then 0 else 1,2
a number or a tuple?  I'm easy either way...)



More information about the Python-list mailing list