On 3/17/21, 6:42 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.
I'm afraid I still don't see how this is true. It would mean that adding a TypeGuard overload to a function that already has a bool overload would need to comply with the rule that the TypeGuard overload must come first, and must return a type that is less than the type returned by the bool overload. But that seems like everything working as desired. A typeguard is a form of bool that carries additional type information, so an overload involving a typeguard instead of a bool should be able to specify a narrower return type. I think it would help me understand a lot better if you can offer a specific real-world example of a desirable function overload that would become illegal if TypeGuard were a subtype of bool. Carl _______________________________________________ Typing-sig mailing list -- mailto:typing-sig@python.org To unsubscribe send an email to mailto:typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: mailto:carljm@instagram.com