Python Conditional Expressions

Python had lacked a C equivalent of the "condition ? true_value : false_value" expression. So we used a work around until now... conditional expressions finally made it in to Python's 2.5 release.

In Python2.4:

x = ((condition) and true_value) or false_value

In Python2.5:

x = true_value if condition else false_value

Yeah, the statement looks better in Python2.5.