因为 是 的子类。您可以在以下位置找到它boolintbuiltins.pyclass bool(int): """ bool(x) -> bool Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed. """所以也.是 当 的类型是 的派生类时。issubclass(bool, int)Trueisinstance(x, y)Truexy
在布尔值中被定义为整数的子类。Python3该均值等价于 as 等价于True1False0您可以在此处找到更多详细信息。该链接的完全相同的解释是:There are three distinct numeric types: integers, floating point numbers, and complex numbers. In addition, Booleans are a subtype of integers