Y
Hacker News
new
|
ask
|
show
|
jobs
by
MapleWalnut
2016 days 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: ...