Open carljm opened 4 months ago
Mypy, pyre, and pyright all already allow protocol types to be assigned to object
. Test program:
from typing import Protocol
def f(x: object) -> None:
pass
def g(x: int) -> None:
pass
class X(Protocol):
foo: int
def h(x: X) -> None:
f(x) # OK: protocol is assignable to object
g(x) # E: protocol is not assignable to int
See https://github.com/python/typing/pull/1743#discussion_r1640641003