People are always wondering if Python has a ternary operator. The answer is yes but no.
There is no recognised ternary operator. However it is very simple to construct one out of logic operations.
Python short circuits conditional evaluations. This means that given a series of logic operations, if it can plainly see that a certain branch of that logic is unreachable or of no consequence it wont even attempt to execute it.