File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2353,7 +2353,8 @@ types.
23532353 See :pep: `544 ` for more details. Protocol classes decorated with
23542354 :func: `runtime_checkable ` (described later) act as simple-minded runtime
23552355 protocols that check only the presence of given attributes, ignoring their
2356- type signatures.
2356+ type signatures. Protocol classes without this decorator cannot be used
2357+ as the second argument to :func: `isinstance ` or :func: `issubclass `.
23572358
23582359 Protocol classes can be generic, for example::
23592360
@@ -2377,8 +2378,7 @@ types.
23772378 Mark a protocol class as a runtime protocol.
23782379
23792380 Such a protocol can be used with :func: `isinstance ` and :func: `issubclass `.
2380- This raises :exc: `TypeError ` when applied to a non-protocol class. This
2381- allows a simple-minded structural check, very similar to "one trick ponies"
2381+ This allows a simple-minded structural check, very similar to "one trick ponies"
23822382 in :mod: `collections.abc ` such as :class: `~collections.abc.Iterable `. For example::
23832383
23842384 @runtime_checkable
@@ -2394,6 +2394,8 @@ types.
23942394 import threading
23952395 assert isinstance(threading.Thread(name='Bob'), Named)
23962396
2397+ This decorator raises :exc: `TypeError ` when applied to a non-protocol class.
2398+
23972399 .. note ::
23982400
23992401 :func: `!runtime_checkable ` will check only the presence of the required
You can’t perform that action at this time.
0 commit comments