PEP 308: I liked the original proposal better
Greg Ewing (using news.cis.dfn.de)
me at privacy.net
Fri Feb 14 04:42:24 CET 2003
I'd like to put in a plea for re-instatement of the original
x if C else y
which I found to be particularly elegant. It's concise,
it reads well, it means just what it says, it resonates
with similar constructs in English and mathematics. It
slots nicely into the syntax without requiring any new
reserved words ("else" can be a pseudo-keyword). Its
meaning should be dead obvious even to someone who's
never seen it before.
The main objection -- that the test is in the middle --
doesn't bother me. In fact, it's precisely that creative
leap which makes it such a refreshingly elegant idea for
me. It dares to be different, and in the process, neatly
solves a problem.
On the other hand, the current proposal
(if C: x else: y)
while workable, is rather dull and boring. It's also a lot
less concise, requiring 4 extra characters, all of which are
rather intrusive-looking punctuation. It feels awkward
and clumsy by comparison.
Right now I think I'm +1 on the original form, and +0 on
the current one.
Having said all that, I'm willing to trust Guido's intuition
on this -- provided that he really is *using* his intuition,
and he hasn't just rejected the original form in order to
appease those who didn't like the test in the middle.
So, Guido -- do you *really* feel that the current proposal
is better than the original one? If you can promise me that,
then I'll consider voting for acceptance when the time comes.
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
More information about the Python-list