bool and int
Weatherby,Gerard
gweatherby at uchc.edu
Tue Jan 24 15:29:39 EST 2023
Booleans work exactly the way the language documentation says they work:
Booleans (bool<https://docs.python.org/3/library/functions.html#bool>)
These represent the truth values False and True. The two objects representing the values False and True are the only Boolean objects. The Boolean type is a subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings "False" or "True"are returned, respectively.
https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy
From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of Dino <dino at no.spam.ar>
Date: Tuesday, January 24, 2023 at 3:04 PM
To: python-list at python.org <python-list at python.org>
Subject: bool and int
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***
$ 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
>>>
WTF!
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jPbvUX9ZXFGYt-q850YI6aQ7ET7BwbF-LIT4XT7MKKwF9OSOgqnaHdM4MbQ7p6YaRCYJYXZ4-XiT3Sko$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jPbvUX9ZXFGYt-q850YI6aQ7ET7BwbF-LIT4XT7MKKwF9OSOgqnaHdM4MbQ7p6YaRCYJYXZ4-XiT3Sko$>
More information about the Python-list
mailing list