Update to PEP308: if-then-else expression

Terry Reedy tjreedy at udel.edu
Tue Feb 11 23:26:13 EST 2003


"Evan Simpson" <evan at 4-am.com> wrote in message
news:mailman.1045003766.5800.python-list at python.org...
> The folks who object to PEP308 regardless of syntax have a point
when
> they observe that conditional expressions seem to be very rare in
> practice.

I challenge this claim.  What means 'very rare'?  In the standard
library, and/or conditionals are used at least twice as often as, for
instance list.reverse().  Does that mean that the reverse method is a
mistake?  (It is, after all, trivial to write a reverse function or
reversing loop.)

If they really think it will be so very rare, why are they so bent out
of shape at the prospect of having to 'very rarely' read someone usage
thereof?

(The questions are for the objectors, not for you, Evan.  But you did
accept their claim as correct.)

Terry J. Reedy




  Given that fact, if Guido agrees to add them to Python, they
> ought to be either "intuitive" or very easy to look up.
>
> None of the punctuation forms is easy to look up, and only the one
taken
> from C is likely to be immediately comprehensible to someone who
isn't
> familiar with them.  If they are chained or used with complex
> expressions, you either need to add as many as *three* sets of
> parentheses, or hope that the "obvious" precedence works.
>
> The "if C: x else: y" syntax is trivial to teach, read, and remember
> *because* it is just like an if-statement in parentheses, with
> expressions instead of statement suites.
>
> Cheers,
>
> Evan @ 4-am
>
>
>






More information about the Python-list mailing list