xoutil.symbols
– Logical values¶
Special logical values like Unset, Undefined, Ignored, Invalid, …
All values only could be True or False but are intended in places where None is expected to be a valid value or for special Boolean formats.
-
xoutil.symbols.
Ignored
= Ignored¶ To be used in arguments that are currently ignored because they are being deprecated. The only valid reason to use Ignored is to signal ignored arguments in method’s/function’s signature
-
xoutil.symbols.
Invalid
= Invalid¶ To be used in functions resulting in a fail where False could be a valid value.
-
xoutil.symbols.
This
= This¶ To be used as a mark for current context as a mechanism of comfort.
-
xoutil.symbols.
Undefined
= Undefined¶ False value for local scope use or where
Unset
could be a valid value
-
xoutil.symbols.
Unset
= Unset¶ False value, mainly for function parameter definitions, where None could be a valid value.
-
class
xoutil.symbols.
boolean
(*args, **kwds)[source]¶ Instances are custom logical values (True or False).
See
__getitem__()
operator for information on constructor arguments.For example:
>>> true = boolean('true', True) >>> false = boolean('false') >>> none = boolean('false') >>> unset = boolean('unset') >>> class X(object): ... attr = None >>> getattr(X(), 'attr') is not None False >>> getattr(X(), 'attr', false) is not false True >>> none is false True >>> false == False True >>> false == unset True >>> false is unset False >>> true == True True