Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
mFixman
on Oct 6, 2020
|
parent
|
context
|
favorite
| on:
Python 3.9
This should stop in a type error just like `0 + False` or `1 + "1"`. This code is almost always a programmer error.
cma
on Oct 6, 2020
[–]
Yeah I wish they didn't let you do arithmetic on Boolean with int without explicit conversion. It can be useful, but the explicit conversion isn't a large burden and prevents many errors.
xapata
on Oct 20, 2020
|
parent
[–]
It's for backwards compatibility. Which everyone who complains about 2 vs 3 should understand.
Before bool existed, some folks had a habit of writing `False = 0` and `True = 1` for readability.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: