Missing#
- class brainstate.typing.Missing[source]#
Sentinel class to represent missing or unspecified values.
This class is used as a default value when None has semantic meaning and you need to distinguish between “None was passed” and “nothing was passed”.
Examples
>>> _MISSING = Missing() >>> >>> def function_with_optional_param(value: Union[int, None, Missing] = _MISSING): ... if value is _MISSING: ... print("No value provided") ... elif value is None: ... print("None was explicitly provided") ... else: ... print(f"Value: {value}") >>> >>> function_with_optional_param() # "No value provided" >>> function_with_optional_param(None) # "None was explicitly provided" >>> function_with_optional_param(42) # "Value: 42"