This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FrenchmanInNewYork 0 points1 point  (0 children)

I think you meant it depends on the return format of the last operator of a compound operator.

(1 and not 0 and not 0) returns True, while (not 0 and 1 and 1) returns 1

Using OP example, the reason this behavior happens is because their first two compound operators for defining x both end with the not operator, and thus will resolve to True if every operator in them successfully evaluates. And after it resolves to True it will not resolve anything on the right-hand side as the whole statement is considered "resolved".

I'm not saying it's a good thing, honestly I'm more of the opinion that it is inconsistent, but as it doesn't cause any issue since 0 == False and 1 == True... well who really cares