Sorry, I don't have the bandwidth to rehash this. One thing I recall is that the bool type is final at runtime, but that's not the only reason.
If all TypeGuards are assignable to bool, but bool is not assignable to any TypeGuard, and at runtime are still always bool (so an "implicit subtype", as I've seen spelled out elsewhere), then the closest analog in any currently available system is int/float, since one can use an in where float is required and it's legal. I can't attach any type information in this way, but I'm trying to work with what I have.
from typing import Any, Callable, overload
Bool = float
TypeGuard = int
def func(x: Callable[..., TypeGuard]) -> str: ...
def func(x: Callable[..., Bool]) -> int: ...
def func(x: Any) -> Any: ...
Pyright in strict mode reports: Overload 1 for "func" overlaps overload 2 and returns an incompatible type
mypy says nothing, due to https://github.com/python/mypy/issues/10143. Perhaps that's some of the source as to why these examples are not working.
I'm going to defer explaining this requirement to either Eric or Guido; it's clear my explanation of this based on what I got through the grapevine isn't holding up to a pile-on.
Typing-sig mailing list -- firstname.lastname@example.org
To unsubscribe send an email to email@example.com
Member address: firstname.lastname@example.org