PEP308: Yet another syntax proposal

Aahz aahz at pythoncraft.com
Tue Feb 11 02:57:06 CET 2003


In article <mailman.1044918694.5993.python-list at python.org>,
James J. Besemer <jb at cascade-sys.com> wrote:
>Aahz wrote:
>> 
>> That's the *only* reason to consider conditional
>> expressions rather than a new builtin conditional function.
>
>Not true, as I and others have explained at length elsewhere.  Readability 
>and maintainability are SERVED by factoring out common sub-expressions from 
>the more verbose forms:
>
>     if condition1:
>         if condition2
>                 targetVar1 = result1
>             else:
>                 targetVarl = result2		# hidden BUG!!
>     else:
>         targetVar1 = result3

How is what you're saying here an argument against a conditional
function?  

    targetVar1 = iif(cond1, iif(cond2, result1, result2), result3)

Seems to me that short-circuit is the *only* reason to dislike iif();
and therefore you need to make your argument on changing the language
(rather than the library) solely on the short-circuit point.  That's a
lot tougher, I think.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Register for PyCon now!  http://www.python.org/pycon/reg.html




More information about the Python-list mailing list