[Python-Dev] Boolean transition (original) (raw)

Paul Prescod paul@prescod.net
Sun, 10 Mar 2002 13:29:38 -0800


"Martin v. Loewis" wrote:

... > The current subtyping strategy provides a better hook for deprecation > warnings. My only concern is that we decide and document that booleans > will one day be as completely unrelated to integers as exceptions are to > strings. I'm not sure that this is desirable. By the same rationale, you should argue that boolean operations on integers are a bad thing. This would be not Pythonic.

Let's take this logic a little further. If you're arguing that booleans should be subtypes of integers because integers can be used in a boolean context then I guess booleans should ALSO be subtypes of strings and lists because strings and lists can also be used in a boolean fashion.

Using an integer as a boolean is common. I do it almost every day I program in languages with both types. Using a boolean as an integer is not common in my programming (though Tim's may be different). Where it crops up in my programming it is probably an error where I passed the parameters to the function in the wrong order.

Paul Prescod