bool behavior in Python 3000?
Steven D'Aprano
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:
>> http://en.wikipedia.org/wiki/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]
because:
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.
--
Steven.
More information about the Python-list
mailing list