People raging over the ternary operation in Python should learn to use:
x = {True: 5, False: 4}[condition()]
, or if you don't want to evaluate the values: x = {True: lambda: 5, False: lambda: 4}[condition()]()