How should one implement ternary (3 valued) logic in python?

1 week ago 11
ARTICLE AD BOX

See wiki article. I have a class that very naturally wants properties which are True, False, or ??. I would like to:

use logical operators is, or, and, and not as usual

stay relatively self-contained, ideally standard lib

I expected to be able to use None, but unfortunately None or False and False or None evaluate to different things (only one of which is what I wanted). What can I do?

I've considered creating a custom 'unknown' class, but I can't overwrite the logical operator behavior.

I've found external libraries like trinary, but they use the |,& syntax instead.

I note this is the logic of a NULL value in SQL, so presumably practices to mimic that behavior would work here.

Read Entire Article