[Python-Dev] PEP 285: Adding a bool type (original) (raw)
Guido van Rossum guido@python.org
Sat, 30 Mar 2002 13:29:29 -0500
- Previous message: [Python-Dev] PEP 285: Adding a bool type
- Next message: [Python-Dev] PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido> Another argument for deriving bool from int: implementation Guido> inheritance. A bool must behave just like an int, and this is Guido> most easily accomplished this way: the bool type doesn't have Guido> implementations for most operations: it inherits them from the Guido> int type, which find a bool acceptable where an int is Guido> required.
[ARK]
Liskov substitutibility would seem to suggest deriving int from bool, not the other way around. That is: If I have a program that uses bool values, I can change it so that it uses int values without affecting the behavior of the program. The reverse is not true.
I wonder if this is the circle-ellipse problem over again?
Probably. We're inheriting implemetation.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PEP 285: Adding a bool type
- Next message: [Python-Dev] PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]