> I also started to ponder about the "'do
> something' if 'true' else 'do this'", and pondered if perhaps
> this statement could do with the including of the keyword do.

Python has support for this in versions >= 2.5:

>>> a = range(0, 5)
>>> b = range(5, 8)
>>> min(a) if sum(a) < sum(b) else min(b)
0

In prior versions, you can use the and/or trick:

>>> (sum(a) < sum(b) and [min(a)] or [min(b)])[0]
0

-Tor Erik
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to