For review: PEP 308 - If-then-else expression

Terry Reedy tjreedy at
Sat Feb 8 06:56:55 CET 2003

"Erik Max Francis" <max at> wrote in message
news:3E447C05.33F8A0B at
> By the way, the same is true in C or C++ with the normal ternary
> operator.  Once you start chaining them together they get really
> really fast.

One needs some discipline in formatting.  I wrote things like

x = cond1 ? expr1 :
      cond2 ? expr2 :
      cond 3? expr3 :
                   expr4 ;

I am not sure but what I would rather stick with and/or when safe
rather then reverse order of conds and exprs.

Terry J. Reedy

More information about the Python-list mailing list