For review: PEP 308 - If-then-else expression
Dan Schmidt
dfan at dfan.org
Sat Feb 8 10:24:33 EST 2003
Erik Max Francis <max at alcyone.com> writes:
| Anthony Baxter wrote:
|
| > Nonetheless, they are valid examples, and my point remains. They
| > are almost impossible to read easily - I _like_ that I can scan
| > through python code and understand it as I'm going, without having
| > to back-track here and there to figure out what a line means.
|
| Any language feature can be abused. I don't think that some potential
| abuses that you see possibly occurring immediately rules out the
| usefulness of a language feature.
And in fact, when I read code by other people who want
ternary-operator-like conciseness so badly that they fake it with the
two-element-array-subscripted-by-a-bool or and-or tricks, I have more
trouble puzzling out what they really mean than if there were a
ternary operator available for them to use in the first place. So
many programs will become easier to read as well (and I'd hope that
there would be a net gain).
(Personally, as badly as I want a ternary operator, I consider the
above tricks too abusive, and write out the extra four lines every
time. But I'm not happy about it.)
Dan
--
http://www.dfan.org
More information about the Python-list
mailing list