![](https://secure.gravatar.com/avatar/a2fc0e250ff81d39df93e62a4ef1ce47.jpg?s=120&d=mm&r=g)
You can't distinguish TypeGuard and bool at run time (as all the runtime type of all TypeGuard variables shall be bool in a well type program) so overload containing both should be rejected. Your argument only strengthens my point. On Wed, Mar 17, 2021 at 5:24 PM Jake Bailey via Typing-sig < typing-sig@python.org> wrote:
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. _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: donovick@cs.stanford.edu