Why is `True is False == False`, False in Python? -
this question has answer here:
why these statements work expected when brackets used:
>>> (true false) == false true >>> true (false == false) true
but returns false
when there no brackets?
>>> true false == false false
based on python documentation operator precedence :
note comparisons, membership tests, , identity tests, have same precedence , have left-to-right chaining feature described in comparisons section.
so have chained statement following :
>>> (true false) , (false==false) false
you can assume central object shared between 2 operations , other objects (false in case).
and note true comparisons, including membership tests , identity tests operations following operands :
in, not in, is, not, <, <=, >, >=, !=, ==
example :
>>> 1 in [1,2] == true false
Comments
Post a Comment