Divide the following example:
>>> {1, True} set([True]) >> >>> {True, 1} set([1])
Why are many represented differently, depending on the order of the elements?
This is because 1, and Trueequal to each other:
1
True
>>> True == 1 True >>> 1 == True True
The set stores one element from each equality class.
bool is a subclass of int class
>>> issubclass(bool, int) True >>> True+1 2 >>> True == 1 True