FW: [Python-Dev] conditional expressions?

gbreed at cix.compulink.co.uk gbreed at cix.compulink.co.uk
Tue Oct 16 11:00:05 CEST 2001


In article <9qgcvk$91j$1 at animus.fel.iae.nl>, cfelling at iae.nl (Carel 
Fellinger) wrote:

> > A conditional expression analogy to list comprehensions would be
> >   x = (a if b else c)
> 
> though I think I like this spelling more, you mixed up a and b, and
> that's probably a likely mistake, so a big disadvantage.  On the other
> hand this clearly looks like an expression to me, a big advantage.

You can also remove the parentheses, and not have to worry about the "if" 
starting a new line.


                      Graham




More information about the Python-list mailing list