bpo-43453: Update and re-add example to typing runtime_checkable (#27013)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
This commit is contained in:
andrei kulakov 2021-07-05 12:23:42 -04:00 committed by GitHub
parent 1b133ab841
commit 17f94e2888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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