I'm still confused by this #python oddity, originally posted by @driscollis:
x = True
y = False
print(x is (not y))
print(not x is y)
print(not (x is y))
print((not x) is y)
print(x is not y)
print(x == (not y))
print(not x == y)
print(not (x == y))
print((not x) == y)
print(x == not y)
Why is the last line a syntax error when the rest are fine?
@sassdawe @driscollis I could understand an "operator precedence" issue being solved with parentheses, but something like x == !y works fine in other languages. Also, why does "x is not y" work but "x == not y" doesn't? I would expect is and == to be syntactically interchangeable.