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

Paul Moore gustav at morpheus.demon.co.uk
Sat Feb 8 17:21:44 EST 2003


Carlos Ribeiro <cribeiro at mail.inet.com.br> writes:

> BTW, my background is Pascal, not C/C++; I'm not familiar with ternary 
> operator either, but I still think that it is a rather succint way to express 
> some constructs.

FWIW, my background is C, and I *like* the ternary operator in C. I
often instinctively want to code ternary operations in Python, too.
But in practice, I never need to (and usually the alternative feels
"better" in some indefinable way).

In fact, I think the C-derived arguments for the ternary operator are
fairly weak when translated to Python. Arguments deriving from the
functional programming school of thought are much harder to refute -
basically because Python has some support for functional-style
programming, but it's not complete (and conditional expressions would
fill one of the gaps - but I'm not sure it would fill all of them).

Paul.
-- 
This signature intentionally left blank




More information about the Python-list mailing list