[Python-Dev] Re: Trinary Operators

Gary Herron gherron@islandtraining.com
Thu, 6 Feb 2003 14:23:02 -0800


On Thursday 06 February 2003 01:18 pm, Eric S. Raymond wrote:
> Gerald S. Williams <gsw@agere.com>:
> > In that case, the "inconsistency in form" is the order of
> > evaluation. The expression in the middle is evaluated,
> > then either the one on the left or the one on the right.
> > Not everyone will see this as a big issue, but it is a
> > potential source of confusion.
>
> Yeeeouch.  And the proposed n-ary form is even worse.

Not really all that bad.  Over all

  (e1 if c1   else   e2 if c2   else  e3)

proceeds left to right through each "en if cn" part.  Of course, the
order in each "en if cn" part is reversed, but you already had that in
the initial ternary form.

Gary Herron