5 ms·
0 == False, right? So any set-like container that uses == and not `is` for equality checks would have to only ever include one of 0 and False. This seems fine t
by bobbylarrybobby 6y ago
0 == False, right? So any set-like container that uses == and not `is` for equality checks would have to only ever include one of 0 and False. This seems fine to me.
- mFixman 6y agoThis 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.