3 ms·
I think it makes sense in python for ==, <=, >= I cannot see it for != "a != b != c" is not equal to "not (a == b == c)" which is a bit strange imo
by the5avage 2y ago
I think it makes sense in python for ==, <=, >=
I cannot see it for !=
"a != b != c" is not equal to "not (a == b == c)" which is a bit strange imo
- irishsultan 2y agoI don't see how you could interpret "a != b != c" as equivalent to "not (a == b == c)" in the first place. In the first expression a doesn't equal b and b doesn't equal c (no restriction on a and c). In the second expression you could have a == b, but b != c (and vice versa), clearly that's not equivalent to the first expression.
- the5avage 2y ago"a == b" is the same as "not (a != b)" Maybe I'm simple minded though.
- int_19h 2y agoIf you treat each "!" as a NOT, then (a != b != c) has two NOTs, but !(a == b == c) has a single one, so this is a bit like expecting that !(a && b) is the same as (!a && !b).
- Doxin 2y ago"a == b == c" translates to "a == b and b == c", similarly "a != b !=c" translates to "a != b and b != c"