PEP 308: I liked the original proposal better
Erik Max Francis
max at alcyone.com
Fri Feb 14 06:54:25 CET 2003
"Greg Ewing (using news.cis.dfn.de)" wrote:
> 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.
If I may be so bold, dullness and strict conciseness objections miss the
point. The goal of a Pythonic conditional operator is one that 1.
exhibits short-circuiting behavior, 2. is readable, and 3. is hopefully
fairly intuitive. I don't care whether the syntax bores me stiff as
long as its readable. I'm not looking for novelty, I'm looking for
Furthermore, the goal isn't _strictly_ to get a form that is as short as
absolutely possible, the goal is to get something readable in an
expression. Four characters' difference seems a trifle.
The main issue with the `x if C else y' form, which I'm neutral toward,
is that it reads in an unexpected order (it's middle-left-right, instead
of strictly left-to-right), and that has been from my experience the
biggest objection to it that has been raised in the threads (and which I
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ The average dog is a nicer person than the average person.
\__/ Andrew A. Rooney
Python chess module / http://www.alcyone.com/pyos/chess/
A chess game adjudicator in Python.
More information about the Python-list