PEP308: Yet another syntax proposal

Andrew Dalke adalke at mindspring.com
Mon Feb 10 21:58:31 CET 2003


Harvey Thomas:
> x = calc(1, iif(cond, resource_intensive_1(), resource_intensive_2()))
>
> In the second case both resource_intensive_1() and resource_intensive_2()
> are evaluated. There is of course the possibility of undesired
side-effects.
>
> You can warn people to not use iif for such cases, but you won't stop it
being used wrongly.

True.  But 1) this case in real code comes up very rarely (perhaps 1 in
5,000 lines of code, based on my analysis) and 2) who is going to look
at something which looks like a function call and assume that it has
anything
other than function call semantics?

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list