问题
Shouldn't it be parsed as (3 in [3]) == True
since in
and ==
have the same precedence? It's definitely not being parsed as 3 in ([3] == True)
since that raises a TypeError
. How else can it be parsed?
p.s. I'm aware that PEP 8 says "Don't compare boolean values to True or False using ==
." This is just an example.
This stemmed from a dicussion on this question
来源:https://stackoverflow.com/questions/60122659/why-is-3-in-3-true-false