Skip to content

Commit 17f94e2

Browse files
bpo-43453: Update and re-add example to typing runtime_checkable (#27013)
Co-authored-by: Ken Jin <[email protected]>
1 parent 1b133ab commit 17f94e2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Doc/library/typing.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,13 @@ These are not used in annotations. They are building blocks for creating generic
12321232

12331233
.. note::
12341234

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

12381243
.. versionadded:: 3.8
12391244

0 commit comments

Comments
 (0)