Proposal: function which simulates C ?: operator

Erik Max Francis max at alcyone.com
Sun Jul 11 22:48:27 EDT 2004


Dan Bishop wrote:

> However, a better alternative is "(C and [T] or [F])[0]", which
> short-circuits and also has the advantage of having the same order as
> "if".

It's got the same order, but it's completely opaque.  It's hardly better
if you're interested in readability.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ Performing in front of a live audience is like a feeling of shock.
    -- Sade Adu



More information about the Python-list mailing list