diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2021-07-05 16:23:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 16:23:42 (GMT) |
commit | 17f94e28882e1e2b331ace93f42e8615383dee59 (patch) | |
tree | cd81621a49b2a2f88702ecad2b34f85dd09666e6 /Doc | |
parent | 1b133ab8412e4f6a53914212df7a7656f376256d (diff) | |
download | cpython-17f94e28882e1e2b331ace93f42e8615383dee59.zip cpython-17f94e28882e1e2b331ace93f42e8615383dee59.tar.gz cpython-17f94e28882e1e2b331ace93f42e8615383dee59.tar.bz2 |
bpo-43453: Update and re-add example to typing runtime_checkable (#27013)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/typing.rst | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index e9980a7..b1d67e4 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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 |