Because in Python 1 == True
(and hash(1) == hash(True)
) and you have 1 in your set already.
Imagine this example:
example1 = {0, False, None}
example2 = {1, True}
print(example1)
print(example2)
Will output:
{0, None}
{1}
First set has 0
and None
because 0 == False
but 0 != None
. With second set 1 == True
so True
isn't added to the set.