if condition value_if_true else value_if_false
is the ternary operator in Python and you can use it in any expression, elif
is a statement that cannot be used in an expression.
If you want to use more complex expressions you can use the example from @p.colbert or create a pick_the_right_value()
function and use that, by entering the function in the databinding, something like self.pick_the_right_value(self.item)