Skip to content

Commit

Permalink
More PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Apr 9, 2024
1 parent d28ad78 commit 5bf8126
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ These can be used as types in annotations. They all support subscription using
Type predicate functions are user-defined functions that return whether their
argument is an instance of a particular type.
``TypeGuard`` works similarly to :data:`TypeIs`, but has subtly different
effects on type checking behavior.
effects on type checking behavior (see below).

Using ``-> TypeGuard`` tells the static type checker that for a given
function:
Expand All @@ -1485,6 +1485,8 @@ These can be used as types in annotations. They all support subscription using
2. If the return value is ``True``, the type of its argument
is the type inside ``TypeGuard``.

``TypeGuard`` also works with type variables. See :pep:`647` for more details.

For example::

def is_str_list(val: list[object]) -> TypeGuard[list[str]]:
Expand Down Expand Up @@ -1513,8 +1515,6 @@ These can be used as types in annotations. They all support subscription using
the variable at all. When a ``TypeIs`` function returns ``False``, type checkers can narrow
the type of the variable to exclude the ``TypeIs`` type.

``TypeGuard`` also works with type variables. See :pep:`647` for more details.

.. versionadded:: 3.10


Expand Down

0 comments on commit 5bf8126

Please sign in to comment.