This example is adapted from https://typing.python.org/en/latest/spec/protocol.html#type-and-class-objects-vs-protocols
from typing import Any, Protocol
class ProtoA(Protocol):
def meth(self, x: int, /) -> int: ...
class ProtoB(Protocol):
def meth(self, obj: Any, x: int, /) -> int: ...
class C:
def meth(self, x: int, /) -> int: ...
a: ProtoA = C # should fail
b: ProtoB = C # should pass
def _(tc: type[C]):
b2: ProtoB = tc # should pass
In ty, all three of these assignments currently fail.