18 Mar
2021
18 Mar
'21
12:23 a.m.
You are still not allowed to write: @overload def func(x: int) -> str: ... @overload def func(x: object) -> int: ... def func(x): ... https://mypy-play.net/?mypy=latest&python=3.9&gist=eacc907d13ee227c04fc177aa706ca2d You can't distinguish TypeGuard from bool in an overload if they have overlapping types but the signature is the same; the point is to change the return value based on the TypeGuard's TypeVar (so you can say, change filter), but if the overload rules don't allow it, then it becomes useless.