[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000
Change by noobie1000 : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000
noobie1000 added the comment: Hello Steven, Sorry, this is my first ever post and was lost in the enormity of issues/documentation. Noted your points :) Thank you. -- resolution: not a bug -> status: closed -> open ___ Python tracker

[issue45891] bool variable isinstance of int

2021-11-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi noobie1000, This is not a general forum for asking questions about Python's design or language, this is for reporting bugs. There are many forums where you can ask "Why" questions and ask for the community to "shed some light on this", such as

[issue45891] bool variable isinstance of int

2021-11-24 Thread Christian Heimes
Christian Heimes 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__ (, , ) >>> True == 1 True >>> True == 2 False >>> False == 0 True -- nosy: +christian.heimes

[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000
New submission from noobie1000 : Hello, Recently I observed that isinstance(x, int) returns True, even when x is defined as a bool. While I understand that internally, a bool is treated as an int with values 0 and 1; to me, this is a bit misleading that the python interpreter returns True