Vote on PEP 308: Ternary Operator

Dave Brueck dave at pythonapocrypha.com
Tue Mar 4 15:04:40 EST 2003


On Tue, 4 Mar 2003, Jack D. Hammer wrote:

> I will vote no ternary operator.
>
> I have not run in to a case where it is needed yet.  I don't think that there
> is any reason to make reading code more complicated.  If the user really want
> to do this, then they can always define their own function that takes three
> paramters.

No, as that does not support short-circuiting. The conditional operator is
_not_ equivalent to a three-arg function. I know, I know, this has been
discussed to death, but many of the 'no' votes have appeared to be from
the 'you can simply do that with a function' camp, which is unfortunate
because those are sort of false 'no' votes since it's based (at least in
part) on a misunderstanding.

Also, the 'you can do this another way' vote is unfortunate because IMO it
misses the point. The language is Turing complete, so pretty much all
features at this point can be done another way. We didn't strictly _need_
list comprehensions, lambdas, augmented assignments, generators, classes,
etc., etc., but having them is very powerful, expressive, useful,
whatever.  Obviously many people feel that the conditional operator is not
powerful, expressive, useful, whatever _enough_ to warrant adding it to
the language - and that's fine, but please don't simply vote against it
because it's not essential.

Just my two cents,
-Dave





More information about the Python-list mailing list