[issue45891] bool variable isinstance of int
Christian Heimes
report at bugs.python.org
Wed Nov 24 08:47:37 EST 2021
Christian Heimes <lists at cheimes.de> added the comment:
This is the expected behavior. The bool type is a subtype of int. True is int 1 in disguise and False is int 0.
>>> bool.__mro__
(<class 'bool'>, <class 'int'>, <class 'object'>)
>>> True == 1
True
>>> True == 2
False
>>> False == 0
True
----------
nosy: +christian.heimes
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45891>
_______________________________________
More information about the Python-bugs-list
mailing list