Should bool continue to inherit from int?
PEP 285 http://legacy.python.org/dev/peps/pep-0285 provides some justification for why arithmetic operations should be valid on bools and why bool should inherit from int (see points (4) and (6) respectively). Since it's been 12 years (it's possible this has been brought up again between now and then), I thought it could be worthwhile to take another look. I am mostly interested in a resurveying of the questions: 1) Would it still be very inconvenient to implement bools separately from ints? 2) Do most Python users still agree that arithmetic operations should be supported on booleans? Follow-up thought: Something I noticed is that with PEP 484 https://www.python.org/dev/peps/pep-0484/ (Type Hints) specified as is, there would be no way to statically verify that a function will only operate on ints and not bools. An example would be a function that can only operate on integer values in a JSON dict created by the builtin `json` module (using the default decoder) cannot exist, as that function could operate on the boolean values of the dict.
participants (14)
-
Alexander Belopolsky
-
Chris Angelico
-
Chris Barker
-
Ethan Furman
-
Greg Ewing
-
Guido van Rossum
-
Joao S. O. Bueno
-
Mark Lawrence
-
Michael Mitchell
-
MRAB
-
Neil Girdhar
-
Rob Cliffe
-
Steven D'Aprano
-
Terry Reedy