> (x + (if is_true(): 1 else: 2)) [is invalid in Python] because the if–else conditional is a statement, and can only be used in certain positions.
Point taken, but troll-mode pedantry: (x + (1 if is_true() else 2)) would be valid :)
Point taken, but troll-mode pedantry: (x + (1 if is_true() else 2)) would be valid :)