[Python-Dev] Re: Trinary Operators
Aahz
aahz@pythoncraft.com
Thu, 6 Feb 2003 16:05:47 -0500
On Thu, Feb 06, 2003, Guido van Rossum wrote:
>Aahz:
>>
>> Are they really equivalent? What about
>>
>> print h() if f() and g()
>>
>> versus
>>
>> if f() and g():
>> print h()
>>
>> Does g() get called if f() is false? What about h()?
>
> Do you know the ternary operator in C?
Thanks to my handy K&R2, now I do. ;-) But I'm always suspicious when
the proposed syntax doesn't have a simple L->R or R->L semantic, which is
the main thing I don't like about listcomps. So I figured I'd make sure.
After all, explicit is better than implicit, and that goes triple when
human languages are used.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/
"Argue for your limitations, and sure enough they're yours." --Richard Bach