Jim Newton <jimka at rdrop.com> writes: > I.e., x = if something: > expr1 > else: > expr2 Try exploiting that a boolean expression evaluates to 0 or 1: x = (expr1, expr2)[something]; Keep in mind that this might break on some later release of Python if they decide to make boolean its own type, but at least it works for 2.3.3.