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 <> wrote:
You are still not allowed to write:

def func(x: int) -> str: ...
def func(x: object) -> int: ...
def func(x): ...

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 --
To unsubscribe send an email to
Member address: