module truthy_falsy¶
Class TF_Bool
Subclass of SBool whose truthy values and falsy values are
different distinct singleton subtypes.
This type can also do (non-shortcut) Boolean logic using Python bitwise operators.
Class T_Bool
The subtype of TF_Bool which is always truthy.
Class F_Bool
The subtype of TF_Bool which is always falsy.
- class pythonic_fp.booleans.truthy_falsy.TF_Bool(witness: object, flavor: Hashable = NoValue())¶
- Parameters:
witness – Determines which subtype,
T_BoolorF_Boolis returned.flavor – Ignored parameter, only two flavors, one truthy and one falsy.
- Returns:
Either The singleton truthy or singleton falsy subtypes.
- final class pythonic_fp.booleans.truthy_falsy.T_Bool(witness: object = NoValue(), flavor: Hashable = NoValue())¶
- Parameters:
witness – Ignored parameter, a T_Bool is always truthy.
flavor – Ignored parameter, only one truthy “flavor”.
- Returns:
The truthy
T_Boolsingleton instance.
- final class pythonic_fp.booleans.truthy_falsy.F_Bool(witness: object = NoValue(), flavor: Hashable = NoValue())¶
- Parameters:
witness – Parameter ignored, an
F_Boolis always falsy.flavor – Parameter ignored, only one falsy “flavor”.
- Returns:
The falsy
F_Boolsingleton instance.
- pythonic_fp.booleans.truthy_falsy.ALWAYS: Final[T_Bool | F_Bool | TF_Bool] = ALWAYS¶
The truthy singleton
TF_Boolsubtype.
- pythonic_fp.booleans.truthy_falsy.NEVER: Final[T_Bool | F_Bool | TF_Bool] = NEVER¶
The falsy singleton
TF_Boolsubtype.
- pythonic_fp.booleans.truthy_falsy.TF_Boolean = pythonic_fp.booleans.truthy_falsy.T_Bool | pythonic_fp.booleans.truthy_falsy.F_Bool | pythonic_fp.booleans.truthy_falsy.TF_Bool¶
Use only as a type, never a constructor.