In Python,
1 in {1} == True
is False
- why?
I first thought it's due to operator precedence, but all I can find (see below) tells me that the expression is evaluated from left to right:
1 in {1}
isTrue
True == True
isTrue
Also, any other precedence would lead to a TypeError
:
{1} == True
isFalse
1 in False
returns aTypeError
Python evaluates expressions from left to right.
https://docs.python.org/3/reference/expressions.html#evaluation-order
Also,
Operators in the same box have the same precedence. [...] Operators in the same box group left to right ([...]).
[...]
https://docs.python.org/3/reference/expressions.html#operator-precedence