You have to use brackets in the statement if the outcome is conditional. 'bar' if aExpression else ('baz' if bExpression)