3 ms·
This should stop in a type error just like `0 + False` or `1 + "1"`. This code is almost always a programmer error.
by mFixman 6y ago
This should stop in a type error just like `0 + False` or `1 + "1"`. This code is almost always a programmer error.
- cma 6y agoYeah 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 6y agoIt'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.