-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Consider the following two protocols:
from typing import Protocol, ClassVar
class P1(Protocol):
x: int
class P2(Protocol):
x: ClassVar[int]In order for a type N to satisy P1's interface, an x attribute needs to be readable with type int on instances of N and also writable with type int on instances of N. The x attribute does not need to be readable or writable on instances of type[N].
In order for a type N to satsify P2's interface, however, an s attribute needs to be readable with type int on instances of N and instances of type[N]. It does not need to be writable on instances of N, but it does need to be writable on instances of type[N].
Reactions are currently unavailable