-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
needs discussiontopic-protocolstopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly
Description
Currently, instantiating explicit subclasses of protocols with "abstract" attributes is prohibited:
class P(Protocol):
x: int # Note, no r.h.s.
class C(P):
pass
class D(P):
def __init__(self) -> None:
self.x = 42
C() # E: Cannot instantiate abstract class 'C' with abstract attribute 'x'
D() # OK
This is feature appeared with little discussion, in particular should this be specific only to protocols or also to "normal" ABCs?
Metadata
Metadata
Assignees
Labels
needs discussiontopic-protocolstopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly