PEP-able? Expressional conditions
apardon at forel.vub.ac.be
Thu Sep 8 14:15:39 CEST 2005
Op 2005-09-07, Terry Reedy schreef <tjreedy at udel.edu>:
> "Kay Schluehr" <kay.schluehr at gmx.net> wrote in message
> news:1126113430.910646.69290 at g44g2000cwa.googlegroups.com...
>> No, as I explained it is not a ternary operator and it can't easily be
>> implemented using a Python function efficiently because Python does not
>> support lazy evaluation.
> By *carefully* using the flow-control operators 'and' and 'or', you can
> often get what you want *now*, no PEP required.
Which is why I don't understand the resistance against introducing
such a beast.
Whether it is a ternary operator or something more general, the
proposed construction are usually more readable than the
python construction with the same functionality.
The decorator syntax IMO provided much less improvement in
readability for functionality that was already provided
and that got implemented.
A ternary operator (or suitable generalisation) would IMO
provide a greater improvement what readability is concerned
but is resisted all the way.
More information about the Python-list