In python 2.5 was added ternary conditional like in c++ and java languages. It is same meanings but different syntax:
a if test else b
First test is evaluated, then either a or b is returned based on the Boolean value of test;
if test evaluates to True a is returned, else b is returned.
>>> 'true' if True else 'false'
>>> 'true' if False else 'false'
There is also another extended form of this expression. Let's describe this form like expression1 ...