Defending the ternary operator

Piet van Oostrum piet at cs.uu.nl
Sat Feb 8 12:11:00 EST 2003


>>>>> Anthony Baxter <anthony at interlink.com.au> (AB) wrote:

>>>> Andrew Koenig wrote
>> The essence of Laura's argument, I think, is that many programmers
>> will not become familiary with if-expressions, as they're used only
>> from time to time, which means that when they do encounter them,
>> it will be a mental stumbling block.

AB> There's also the point that "if" already has existing meanings. This
AB> means that it's use in this rare form (at least, I'd hope it's rare;
AB> if a piece of code features a large number of ternary expressions,
AB> I'd question the sanity of the author), it will confuse the reader
AB> even more.

In all context is has a sim ilar meaning: that something depends on the
condition. 
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl




More information about the Python-list mailing list