True == 1 weirdness

jmp jeanmichel at sequans.com
Wed Sep 16 15:08:26 CEST 2015


On 09/16/2015 02:16 PM, Blake T. Garretson wrote:
>>>> 1 in {1:1} == 1   #test2

>The second test yield False, because True does not equal 1, apparently.  Fair enough.

No, it yields False because {1:1} == 1 is false. Test 2 looks actually like

(1 in {1:1}) and ({1:1} == 1).

Which in your example does not make any sense but think of this one:

x = 5
3 < x < 10

JM



More information about the Python-list mailing list