> Because Python used not to have a boolean type and used the integers 0
and 1 instead
Exactly as Jon says. I wrote a post some time ago with more info about it:
https://blog.rmotr.com/those-tricky-python-booleans-2100d5df92c
On Fri, Nov 16, 2018 at 12:23 PM duncan smith
wrote:
> On 16/11/18 14
A boolean type didn't come about until version 2.3, and even now they still
inherit from integers.
Some links for you:
https://docs.python.org/3.7/whatsnew/2.3.html#pep-285-a-boolean-type
https://docs.python.org/3.7/library/stdtypes.html#boolean-values
https://docs.python.org/3.7/reference/datam
On 16/11/18 14:51, Steve Keller wrote:
> Why do the integers 0 and 1 compare equal to the boolean values False
> and True and all other integers to neither of them?
>
> $ python3
> Python 3.5.2 (default, Nov 12 2018, 13:43:14)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyrig
On 2018-11-16, Steve Keller wrote:
> Why do the integers 0 and 1 compare equal to the boolean values False
> and True and all other integers to neither of them?
Because Python used not to have a boolean type and used the integers
0 and 1 instead, so when the boolean type was introduced True and
F