For review: PEP 308 - If-then-else expression
adalke at mindspring.com
Sun Feb 9 01:32:30 CET 2003
> I'd be interested to know how many real cases would actually rely on
> short-circuit evaluation.
I looked at about 30 examples in the Linux kernel. Few needed it, though
I don't reacall the numbers. I looked at 16 different kinds of uses
of ?: in a proprietary C++ codebase I have access to. Only a couple
needed it, in the form "p == NULL ? 0 ? p->method()". More often
it was incorrectly or confusingly used, or used as a replacement for
My best estimates are about one use of if/else expression per
1,000 lines of Python code, for the population who is writing
code in my field, so figure 1 in 4,000 lines where short-circuiting
Results posted elsewhere.
dalke at dalkescientific.com
More information about the Python-list