bool and int

Rob Cliffe rob.cliffe at btinternet.com
Tue Jan 24 16:40:48 EST 2023



On 24/01/2023 04:22, Dino wrote:
>
> $ python
> Python 3.8.10 (default, Mar 15 2022, 12:22:08)
> [GCC 9.4.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> b = True
> >>> isinstance(b,bool)
> True
> >>> isinstance(b,int)
> True
> >>>
>
That immediately tells you that either
     bool is a subclass of int
     int is a subclass of bool
     bool and int are both subclasses of some other class
In fact the first one is true.
This is not a logical necessity, but the way Python happens to be designed.
Best wishes
Rob Cliffe


More information about the Python-list mailing list