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

Andrew Dalke adalke at mindspring.com
Fri Feb 7 23:36:37 EST 2003


<cribeiro at mail.inet.com.br>:
> Oh well. I just gave up discussing short-circuiting evaluation and there
> we go again. The two blocks of code are not equivalent; change z for an
> expression with some side effect (for example, a function call), and then
> the results will be completely different.

Though in most cases I can find in C, the short-circuiting doesn't
change anything except improve performance slightly.  Very few
cases use the

    a ? f() : g()

idiom.  So while what you say is true, it isn't a very strong requirement
for most real-life cases.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list