C's ?: expression
Curtis Jensen
cjensen at bioeng.ucsd.edu
Thu Apr 6 20:16:22 EDT 2000
I while back I posted about how to simulate C's ?: expression in
Python. There were quite a few responces to it. Recently, I found on
pp135-136 of Mark Lutz's "Programmin Python" book that there is a way.
If anyone is interested:
((TEST and [trueAction]) or [falseAction])[0]
where TEST is the boolean expression and tueAction is what to do if the
expression is true and falseAction is what to do if the expression is
false.
--
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451
More information about the Python-list
mailing list