For review: PEP 308 - If-then-else expression

Dan Schmidt dfan at dfan.org
Fri Feb 7 15:41:07 EST 2003


Eru <ripolles at LALALAaditel.org> writes:

| Guido van Rossum <guido at python.org> escribio:
| > 
| > Proposal
| > 
| >    The proposed syntax is as follows:
| > 
| >        <expression1> if <condition> else <expression2>
| 
| If I may give my opinion, I don't like much that syntax. I think it
| introduces too much "potential obfuscation". I think it's too perlish
| to be pythonic. And if we add the "empty else" option (A if condition)
| it starts getting difficult to read.

What would '(A if condition)' evaluate to if condition is false?  None?
I assume that the else is required, just as you can't say
(condition ? A) in C.

| I would prefer the a?b:c way. It doesn't introduce new punctuation (which
| leds to more difficulty when explaining the syntax, and remembering
| it).

The question mark would be new punctuation, wouldn't it?

Dan

-- 
http://www.dfan.org




More information about the Python-list mailing list