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

Terry Reedy tjreedy at udel.edu
Thu Sep 29 23:15:36 CEST 2005


"Guido van Rossum" <guido at python.org> wrote in message 
news:ca471dc2050929073236fae78c at mail.gmail.com...
> After all there's nothing wrong with and/or.

This is one reason 'no addition' got a relatively high rank in the vote.

Examples...
> telnet~1.py:        'DO' if cmd == DO else 'DONT',
versus                    cmd == DO and 'DO' or 'DONT'

I still stronly prefer this order and even slightly prefer this form.  I 
might even prefer a complete inversion of the order: x else y if c
                             'DO' else 'DONT' if cmd != DO
except that that does not chain at all well.

Terry J. Reedy





More information about the Python-Dev mailing list