What is a TypeVar?
Type hints and typing
Audio flashcard · 0:14Nortren·
What is a TypeVar?
0:14
A TypeVar is a type variable used to write generic functions and classes. It allows you to express that two parameters or a parameter and return value have the same type without committing to a specific one. Generics enable type-safe containers and higher-order functions.
docs.python.org