Is there a reason why this doesn’t work in Python?
if 1 != 1 or
2 != 2:
print 'Something is wrong...'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps this prevents a grammar ambiguity, but I feel that this behaviour is in the spirit of PEP 20, specifically ‘Simple is better than complex’ (among others). In other words, ‘Unless you have a good reason, why should expressions span multiple lines?’. If you have a good reason, the syntax devices to get around this are provided.
[edit]
I did some more reading, and there are a few references of interest:
\) continuation, but was rejected due to lack of support.My final point is, the slash acts (or open parens) acts as a reminder that the statement is continued on the next line. Depending on your indentation, it’s possible that the continuation could be mistaken for a separate statement (which I think this other response touches on).