For review: PEP 308 - If-then-else expression

Andrew Koenig ark at research.att.com
Sat Feb 8 20:31:37 EST 2003


>> 2) It evaluates both alternatives even though only one is needed.

Paul> I'd like to see some concrete examples of where this is a
Paul> significant issue.

It's *always* significant to me, because it gets in the way of saying
what I mean.  I don't want to write (x, y)[not z] instead of (x if z
else y) because when z is true, I don't want the reader to have to
care at all about y (and similarly, when z is false, I don't want the
reader to have to care about x).  Efficiency doesn't enter to it,
at least not for me.


-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list