True/False story... (PEP 285)

Boris Borcic borcis at geneva-link.ch
Tue Apr 9 09:01:11 EDT 2002


Alex Martelli wrote:


> there IS a natural mapping of booleans onto a subset
> of integers, just as there is a natural mapping of
> integers onto a subset of reals (or rationals, etc).


Could be argued that there is no single natural mapping, for an 
alternate to the current one we could have

True     == 1
False    == -1
not x    == -x
x and y  == min(x,y)
x or y   == max(x,y)
x xor y  == -x*y

A nice feature of that one (to my aesthetics), is that

1j == sqrt(False)

It also meshes well with the cyclotomic fields.

Boris
--
"Hope achieves the square root of the impossible"




More information about the Python-list mailing list