Newbie: Truth values (three-valued logic)

Blake Winton bwinton at tor.dhs.org
Sat Jun 19 05:39:49 CEST 1999


On Fri, 18 Jun 1999, Olaf Delgado wrote:
>On Fri, 18 Jun 1999, Tim Peters wrote:
>> [Olaf Delgado]
>I understand that. A new meaning for "and" and "or" would have to be
>built into the language, but I don't think the merits would justify the
>efforts.  The simplest way I see would be to introduce a new type with
>a single value "Maybe", similar to "None", which would have to be
>handled specially by "if", "not", "and" and "or". It should be
>relatively simple to implement this, as far as I can see, but of course
>it would slow down things by having to consider all those special
>cases.

[snip]

>Or I could set __and__(x,y)=x*y and __or__(x,y)=x+y-x*y. Then I only
>would have to invent a way to partially execute a block of code. :)

Wasn't it Intercal which first had something like this?

if Maybe:
    # do this some of the time
else:
    # do this other times
    # or is that do part of this, and part of that?

I think the first is fairly easy to hack up, but the second would
probably require some ByteCodeHacks (tm).  Now I'm starting to be
interested in one-value logic.  I'm just not sure whether I want the
value to be "True", "False", or "Maybe".

Later,
Blake.

-- 
One Will.  One Dream.  One Truth.  One Destiny.  One Love.




More information about the Python-list mailing list