fqr.core.strings.lib module¶
Strings imports.
- class TypeVarTuple¶
Bases:
objectType variable tuple. A specialized form of type variable that enables variadic generics.
The preferred way to construct a type variable tuple is via the dedicated syntax for generic functions, classes, and type aliases, where a single ‘*’ indicates a type variable tuple:
.. code::
For compatibility with Python 3.11 and earlier, TypeVarTuple objects can also be created as follows:
.. code::
Ts = TypeVarTuple(‘Ts’) # Can be given any name
Just as a TypeVar (type variable) is a placeholder for a single type, a TypeVarTuple is a placeholder for an arbitrary number of types. For example, if we define a generic class using a TypeVarTuple:
.. code::
class C[*Ts]: …
Then we can parameterize that class with an arbitrary number of type arguments:
.. code::
C[int] # Fine C[int, str] # Also fine C[()] # Even this is fine
For more details, see PEP 646.
Note that only TypeVarTuples defined in the global scope can be pickled.