[Python-Dev] Adding a conditional expression in Py3.0

Terry Reedy tjreedy at udel.edu
Wed Sep 21 00:24:27 CEST 2005

"Guido van Rossum" <guido at python.org> wrote in message 
news:ca471dc2050920121778df3fcd at mail.gmail.com...
> On 9/20/05, Terry Reedy <tjreedy at udel.edu> wrote:
>> Given the later addition of generator expressions with mandatory
>> parentheses , the mandatory-parentheses version of a conditional 
>> expression
>> looks less strange to me than it did then ;-).  So I could happily use 
>> it
>> even though I may still lean toward the other option 2 version 
>> (then-else)
>> due to  its not needing ':'s or a third elseif term for chaining.
> I think I'd prefer (if <expr> then <expr> else <expre>) i.e. no
> colons. None of the other  expression forms (list comprehensions and
> generator expressions) involving statement keywords use colons.

I presume this revision would continue to include elif clauses.  If I put 
on a 'designing Python for everyone' hat, then the presence of the leading 
'if' looks better than the slightly-too-cute (especially for Python) 
abbreviated version.

>> *If* you want general community input, I would suggest a runoff ballot 
>> with
>> those four choices (and a summary of pros and cons of each), or fewer if
>> you see any as unacceptible.
> If there's one thing I've learned from the PEP 308 vote, it is that
> votes for language don't work. I prefer some discussion on Python-dev
> after which I pick one.

If we reject both the status quo and the symbol-tax form and agree on the 
above as the best wordy form, then it is a moot point anyway ;-)

C.l.p. newcomers continue to periodically request "How do I write 
conditional expressions?".  I think most will be happier with something 
clear and readable.

Terry J. Reedy

More information about the Python-Dev mailing list