typelets.symbols

Common symbols useful for functions, variables, and types.

Added in version 1.0.

Module Attributes

UNSET

An instance of a symbol indicating an unset value.

Unsettable

A generic type alias for marking a type as unsettable.

Classes

UnsetSymbol(value[, names, module, ...])

A type indicating an unsettable value.

class typelets.symbols.UnsetSymbol(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A type indicating an unsettable value.

This can be useful in functions that take default values to distinguish between a value not provided and a False/None value.

Added in version 1.0.

UNSET = '<UNSET>'[source]
typelets.symbols.UNSET: Final[Literal[UnsetSymbol.UNSET]] = UnsetSymbol.UNSET

An instance of a symbol indicating an unset value.

Added in version 1.0.

typelets.symbols.Unsettable

A generic type alias for marking a type as unsettable.

This allows for usage like:

def __init__(
    self,
    value: Unsettable[str],
) -> None:
    ...

Added in version 1.0.

alias of Literal[UNSET] | _T