bagof.hints.typevars.co
Covariant TypeVars.
A covariant parameter preserves the subtype relation of its argument:
since bool is a subtype of int, Producer[bool] is a subtype of
Producer[int] and is usable wherever the latter is expected. That is
only sound when the parameter appears in output ("producer") positions
alone -- return types, read-only attributes. A generic class that also
takes the parameter as an input must use an invariant TypeVar instead.
Every TypeVar here carries an upper bound (not a set of value constraints), so it can be solved for any subtype of that bound, and never for an unrelated type.
Attributes
K
module-attribute
A covariant TypeVar for hashable objects (with a compact name).
T
module-attribute
A covariant TypeVar (with a compact name).
OBJECT
module-attribute
A covariant TypeVar for objects.
TYPE
module-attribute
A covariant TypeVar for types.
NONE
module-attribute
A covariant TypeVar for None values.
STR
module-attribute
A covariant TypeVar for strings.
BYTES
module-attribute
A covariant TypeVar for bytes.
BOOL
module-attribute
A covariant TypeVar for booleans.
INT
module-attribute
A covariant TypeVar for (builtin) ints.
FLOAT
module-attribute
A covariant TypeVar for (builtin) floats.
COMPLEX
module-attribute
A covariant TypeVar for (builtin) complex numbers.
INTEGRAL
module-attribute
A covariant TypeVar for integral numbers.
REAL
module-attribute
A covariant TypeVar for real numbers.
NUMBER
module-attribute
A covariant TypeVar for numeric values.
CONTAINER
module-attribute
A covariant TypeVar for containers.
HASHABLE
module-attribute
A covariant TypeVar for hashable objects.
ITERABLE
module-attribute
A covariant TypeVar for iterables.
ITERATOR
module-attribute
A covariant TypeVar for iterators.
REVERSIBLE
module-attribute
A covariant TypeVar for reversibles.
GENERATOR
module-attribute
A covariant TypeVar for generators.
SIZED
module-attribute
A covariant TypeVar for sized objects.
COLLECTION
module-attribute
A covariant TypeVar for collections.
SEQUENCE
module-attribute
A covariant TypeVar for sequences.
MUTABLE_SEQUENCE
module-attribute
A covariant TypeVar for mutable sequences.
SET
module-attribute
A covariant TypeVar for sets.
MUTABLE_SET
module-attribute
A covariant TypeVar for mutable sets.
MAPPING
module-attribute
A covariant TypeVar for mappings.
MUTABLE_MAPPING
module-attribute
MUTABLE_MAPPING = tx.TypeVar('MUTABLE_MAPPING', covariant=True, bound=tx.MutableMapping[tx.Any, tx.Any])
A covariant TypeVar for mutable mappings.
AWAITABLE
module-attribute
A covariant TypeVar for awaitables.
BUFFER
module-attribute
A covariant TypeVar for buffers.
LIST
module-attribute
A covariant TypeVar for lists.
TUPLE
module-attribute
A covariant TypeVar for tuples.