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

Andrew Koenig ark at research.att.com
Mon Feb 10 03:23:09 CET 2003


Erik> Why do people keep looking for a magic bullet that will be an
Erik> expression that clearly _must_ be expressed with a conditional
Erik> operator?

Paul> Because they can't make their point any other way. Oh, hang on -
Paul> you didn't notice that the people putting up the expressions
Paul> which keep getting shot down are the pro-PEP people...

Paul> The burden of proof is on those who want this change - justify it.

Of course, if you're anti-PEP, no example will be sufficient, because
any program that uses a conditional operator can be written with one
of several circumlocutions.

And to me, that fact by itself is a strong argument:  Different people
have found themselves wanting an if-then-else expression badly enough
to want to write it in several different ways.

Moreover, the most concise of those ways (cond and expr1 or expr2)
is broken (because if cond is true and expr is false, the result is
expr2 instead of expr1).


-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list