Re: Why do integers compare equal to booleans?

2018-11-16 Thread Santiago Basulto
> 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

RE: Why do integers compare equal to booleans?

2018-11-16 Thread David Raymond
/datamodel.html#the-standard-type-hierarchy -Original Message- From: Python-list [mailto:python-list-bounces+david.raymond=tomtom@python.org] On Behalf Of Steve Keller Sent: Friday, November 16, 2018 9:51 AM To: python-list@python.org Subject: Why do integers compare equal to booleans

Re: Why do integers compare equal to booleans?

2018-11-16 Thread duncan smith
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",

Re: Why do integers compare equal to booleans?

2018-11-16 Thread Jon Ribbens
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

Why do integers compare equal to booleans?

2018-11-16 Thread Steve Keller
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", "copyright", "credits" or "license" for more information.