diff --git a/peps/pep-0724.rst b/peps/pep-0724.rst index a6ae5a1d295..b00b724fbe3 100644 --- a/peps/pep-0724.rst +++ b/peps/pep-0724.rst @@ -83,6 +83,19 @@ The following code sample demonstrates both of these limitations. return ``TypeGuard`` type was not a subtype of the input type. Refer to :pep:`647` for examples. +Rationale +========= + +There are a number of issues where a stricter ``TypeGuard`` would have +been a solution: + +* `Python typing issue - TypeGuard doesn't intersect like isinstance `__ +* `Pyright issue - TypeGuard not eliminating possibility on branch `__ +* `Pyright issue - Type narrowing for Literal doesn't work `__ +* `Mypy issue - TypeGuard is incompatible with exhaustive check `__ +* `Mypy issue - Incorrect type narrowing for inspect.isawaitable `__ +* `Typeshed issue - asyncio.iscoroutinefunction is not a TypeGuard `__ + Specification =============