Apr-10-2020, 07:17 PM
Hi,
could someone here explain to me why the first boolean expression of thread subject (namely « 1 in [2] == False ») evaluates to False whereas second (namely «(1 in [2]) == False ») gives True? (checked under python3 interpreter)
Thank's in advance,
F.B.
P.S.1: I know well this could/should better be rewritten «1 not in [2]»...but it doesn't explain why both expressions don't evaluate with the same result.
P.S.2: I first thought that this strange behaviour had to do with operator precedence, but I found on the web that « in » and « == » operators have same priority, so the question remains.
could someone here explain to me why the first boolean expression of thread subject (namely « 1 in [2] == False ») evaluates to False whereas second (namely «(1 in [2]) == False ») gives True? (checked under python3 interpreter)
Thank's in advance,
F.B.
P.S.1: I know well this could/should better be rewritten «1 not in [2]»...but it doesn't explain why both expressions don't evaluate with the same result.
P.S.2: I first thought that this strange behaviour had to do with operator precedence, but I found on the web that « in » and « == » operators have same priority, so the question remains.