PEP 308: A PEP Writer's Experience - CON
Andrew Dalke
adalke at mindspring.com
Sat Feb 8 21:03:15 EST 2003
Michael Chermside
> There are lots of arguments against having a ternary expression,
> and I do not find them convincing. Here I will list the main
> objections I heard last time around, and respond to each.
> [1] You can already achieve the same thing with an if statement
>
> Well, yes... that's true. And that's why any decent arguments
> in favor of a ternary expression must show why it's good to
> have _in addition_ to the if statement.
Especially when it seems (from my analysis) that in real-life
code this is used about once every 1,000 lines or so, at
least for users in my domain.
And you forgot
[5] it is prone to misuse, hiding possible bad coding style
Which seems to be more frequent than good use, at least
in my analysis.
And the relatively minor one
[6] Is harder to debug, because you'll need to break out the
different terms before you can add print statements to them
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list