Skip to content

Commit

Permalink
PEP 724: Add the Rationale section (#3447)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchiodo authored Sep 23, 2023
1 parent a703204 commit a159a9a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions peps/pep-0724.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/python/typing/issues/1351>`__
* `Pyright issue - TypeGuard not eliminating possibility on branch <https://github.com/microsoft/pyright/issues/3450>`__
* `Pyright issue - Type narrowing for Literal doesn't work <https://github.com/microsoft/pyright/issues/3466>`__
* `Mypy issue - TypeGuard is incompatible with exhaustive check <https://github.com/python/mypy/issues/15305>`__
* `Mypy issue - Incorrect type narrowing for inspect.isawaitable <https://github.com/python/mypy/issues/15520>`__
* `Typeshed issue - asyncio.iscoroutinefunction is not a TypeGuard <https://github.com/python/typeshed/issues/8009>`__


Specification
=============
Expand Down

0 comments on commit a159a9a

Please sign in to comment.