Skip to content

Commit 01d7f9b

Browse files
committed
PEP 544: Fix errors in class object example
1 parent 0cac70c commit 01d7f9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pep-0544.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ A class object is considered an implementation of a protocol if accessing
770770
all members on it results in types compatible with the protocol members.
771771
For example::
772772

773-
from typing import Any, Protocol
773+
from typing import Any, Protocol, Type
774774

775775
class ProtoA(Protocol):
776776
def meth(self, x: int) -> int: ...
@@ -780,8 +780,8 @@ For example::
780780
class C:
781781
def meth(self, x: int) -> int: ...
782782

783-
a: ProtoA = C # Type check error, signatures don't match!
784-
b: ProtoB = C # OK
783+
a: Type[ProtoA] = C # OK
784+
b: Type[ProtoB] = C # Type check error, signatures don't match!
785785

786786

787787
``NewType()`` and type aliases

0 commit comments

Comments
 (0)