4 ms·
You can use typing.TypeVar for the `pow()` example. TypeVar was added via the original type hints PEP in 2014. from typing import TypeVar T = TypeVar(
by MapleWalnut 6y ago
You can use typing.TypeVar for the `pow()` example. TypeVar was added via the original type hints PEP in 2014.
from typing import TypeVar
T = TypeVar('T', int, float)
def pow(base: T, power: T) -> T: ...