Skip to content

Commit

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

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
  • Loading branch information
akulakov and Fidget-Spinner committed Jul 5, 2021
1 parent 1b133ab commit 17f94e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Doc/library/typing.rst
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 17f94e2

Please sign in to comment.