PEP308: Yet another syntax proposal

Andrew Dalke adalke at mindspring.com
Mon Feb 10 15:56:14 EST 2003


Dave Brueck
> Several of the previous examples have already illustrated this:
>
> z = iif(x, x.getPref(), 'Not specified')
>
> is broken without short-circuiting.

Indeed.  And my best meta-analysis of the code analysis done by
me and others suggests that this form is needed about once every
5,000 lines of code, while a non-short-circuiting function would be
used much more frequently.  (I didn't do the analysis of the uses
if an iff() statement, but based on the other results it would be
at least 1 per 1,000 lines, and more likely more often than that,
so my educated guess is about 1 every 400 lines or so.)

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list