![](https://secure.gravatar.com/avatar/a2fc0e250ff81d39df93e62a4ef1ce47.jpg?s=120&d=mm&r=g)
The only use case I can come up with is something like: ``` @overload def filter(f: Callable[..., TypeGuard[int]], x: Sequence[object]) -> Sequence[int]: ... @overload def filter(f: Callable[..., bool], x: Sequence[object]) -> Sequence[object]: ... def filter(x): ... ``` Except that will work regardless of whether or not TypeGuard is a subtype of bool. https://mypy-play.net/?mypy=latest&python=3.9&gist=c918fdc74eeab7771f921666fe04f80c On Wed, Mar 17, 2021 at 5:47 PM Caleb Donovick <donovick@cs.stanford.edu> wrote:
Give me a concrete example of an overload you want to write but wouldn't be able to if `TypeGaurd` is considered a subtype of bool by type checkers. (again regardless of what type checkers think typeguard variables will be bools so `isinstance(guard, bool)` is going to be True and `isinstance(guard, TypeGuard)` is going to raise TypeError).
On Wed, Mar 17, 2021 at 5:41 PM Jake Bailey via Typing-sig < typing-sig@python.org> wrote:
Except then no existing function (like filter) could ever get a new overload with TypeGuard, because the compatibility would make it illegal, reducing it's usefulness. _______________________________________________ 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