考虑以下示例:
>>> {1, True} set([True]) >> >>> {True, 1} set([1])
int
True==1
False==0
1
True
>>> True == 1 True >>> 1 == True True
判断是否为 int 类的子类
>>> issubclass(bool, int) True >>> True+1 2 >>> True == 1 True
int
的子类,且True==1
(以及False==0
),所以这是一个重复的问题。 - Martijn Pieters