Skip to content

Commit

Permalink
bpo-43453: Update and re-add example to typing runtime_checkable (pyt…
Browse files Browse the repository at this point in the history
…honGH-27013)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 17f94e2)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
  • Loading branch information
akulakov authored and miss-islington committed Jul 5, 2021
1 parent f3289a5 commit f14585d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,13 @@ These are not used in annotations. They are building blocks for creating generic

.. note::

:func:`runtime_checkable` will check only the presence of the required methods,
not their type signatures.
:func:`runtime_checkable` will check only the presence of the required
methods, not their type signatures. For example, :class:`ssl.SSLObject`
is a class, therefore it passes an :func:`issubclass`
check against :data:`Callable`. However, the
:meth:`ssl.SSLObject.__init__` method exists only to raise a
:exc:`TypeError` with a more informative message, therefore making
it impossible to call (instantiate) :class:`ssl.SSLObject`.

.. versionadded:: 3.8

Expand Down

0 comments on commit f14585d

Please sign in to comment.