Tribool API Reference

class tribool.Tribool

Implementation of three-valued logic.

Tribool represents True, False, or Indeterminate as a tuple of one value set to True, False, or None respectively.

__and__(that)

Logical and of Tribool and that.

__bool__()

Raise TypeError on conversion to bool.

When this occurs, it may indicate that the logical operators: (and, or, not) were used. Python does not permit overloading these operators. Use the bitwise (&, |, ^, ~) operators instead. Likewise, if the comparison operators (<, <=, >, >=) were used then a type conversion using Tribool(...) is required.

__copy__()

Return self (singleton pattern).

__deepcopy__(that)

Return self (singleton pattern).

__eq__(that)

Logical equality of Tribool and that.

__ge__(that)

Logical greater than or equal of Tribool and that.

__gt__(that)

Logical greater than of Tribool and that.

__hash__()

Hash of Tribool.

__invert__()

Logical negation of Tribool value.

__le__(that)

Logical less than or equal of Tribool and that.

__lt__(that)

Logical less than of Tribool and that.

__ne__(that)

Logical inequality of Tribool and that.

static __new__(value=None)

Create Tribool object.

value may be any of True, False, None, Tribool or a name like ‘True’, ‘False’, ‘None’, ‘Indeterminate’, or ‘Unknown’. None is representative of an indeterminate boolean value. Instances with the same value are identical (singleton-like). This method is thread-safe.

__nonzero__()

Raise TypeError on conversion to bool.

When this occurs, it may indicate that the logical operators: (and, or, not) were used. Python does not permit overloading these operators. Use the bitwise (&, |, ^, ~) operators instead. Likewise, if the comparison operators (<, <=, >, >=) were used then a type conversion using Tribool(...) is required.

__or__(that)

Logical or of Tribool and that.

__rand__(that)

Logical and of Tribool and that.

__reduce__()

Pickle self (singleton pattern).

__repr__()

String representation of Tribool.

__ror__(that)

Logical or of Tribool and that.

__rxor__(that)

Logical xor of Tribool and that.

__str__()

String representing Tribool value.

__xor__(that)

Logical xor of Tribool and that.

value

Shortcut for internal and immutable True, False or None value.