bool behavior in Python 3000?
steve at REMOVE.THIS.cybersource.com.au
Wed Jul 11 01:17:51 CEST 2007
On Tue, 10 Jul 2007 23:42:01 +0200, Bjoern Schliessmann wrote:
> Alan G Isaac wrote:
>> My preference would be for the arithmetic operations *,+,-
>> to be given the standard interpretation for a two element
>> boolean algebra:
>>>> [bool(True+True), bool(True+False)]
> [True, True]
> Works for me, or did I misunderstand you?
It seems to me that you deliberately misunderstood him. Why else would you
type-cast the integers 2 and 1 to bools to supposedly demonstrate that
there's nothing wrong with operations between bools returning ints?
I mean, by that logic, it should be okay if we had
False = 
True = [None]
bool(False + True), bool(True + True)
also gives (True, True). But that doesn't justify the choice of bools
being lists any more than it justifies the choice of bools being ints.
More information about the Python-list