Generic Types

suggest change

The typing.TypeVar is a generic type factory. It’s primary goal is to serve as a parameter/placeholder for generic function/class/method annotations:

import typing

T = typing.TypeVar("T")

def get_first_element(l: typing.Sequence[T]) -> T:
	return l[0]

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents