Consider the following function
import typing
def make_list(el : typing.Any):
return [el, el]
How do I hint that it returns
typing.List[type(el)]
pythonpython-typingtype-hinting
Consider the following function
import typing
def make_list(el : typing.Any):
return [el, el]
How do I hint that it returns
typing.List[type(el)]
Best Answer
That's what
TypeVar
is for: