Skip to content

Commit fbe0191

Browse files
committed
Attribute access off a protocol's type shouldn't have a known type
1 parent 4186484 commit fbe0191

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

peps/pep-0767.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ This has a few subtyping implications. Borrowing from :pep:`705#inheritance`:
498498
has_name = NamedDescriptor()
499499

500500
Type checkers should not assume that access to a protocol's read-only attributes
501-
is supported by the protocol's type (``type[HasName]``).
501+
is supported by the protocol's type (``type[HasName]``). Even if the attribute
502+
exists on the protocol's type, no assumptions should be made about its type.
502503

503504
Accurately modeling the behavior and type of ``type[HasName].name`` is difficult,
504505
therefore it was left out from this PEP to reduce its complexity;

0 commit comments

Comments
 (0)