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

Terry Reedy tjreedy at udel.edu
Sat Feb 8 00:56:55 EST 2003


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3E447C05.33F8A0B at alcyone.com...
> 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
ugly,
> 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