[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On 2018-11-16, Steve Keller <keller at no.invalid> 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 False were made to behave very much like 1 and 0 for backwards compatibility reasons.

- Prev by Date:
**Generators, generator expressions, and loops** - Next by Date:
**Why do integers compare equal to booleans?** - Previous by thread:
**Why do integers compare equal to booleans?** - Next by thread:
**Why do integers compare equal to booleans?** - Index(es):