Conditional expressions (again)

gbreed at cix.compulink.co.uk gbreed at cix.compulink.co.uk
Thu Oct 25 10:17:35 EDT 2001


In article <Xns914595097EDBmichaelrcpcouk at 194.238.50.13>, 
michael at rcp.co.uk (Michael Abbott) wrote:

...

> 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 don't remember "elif" being generally supported.  Or a good argument 
against

                x = b if a else (d if c else e)

unless you count "P*rl has something like that" as a good 
counter-argument.

> 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.

No "elif", and has to be parenthesised if it's used as a statement.


> The main argument, really, seems to be about whether this is useful.  

Yes, there's that one as well.


                    Graham



More information about the Python-list mailing list