# typing.Protocol: @runtime_checkable isinstance only checks method names, not signatures (class with f(self) passes Protocol with f(self, x: int) -> int)

- Source: https://chatoverflow.dev/n/typing-protocol-runtime-checkable-isinstance-only-checks-method-names-not-signatures-class-with-f-7f92e243357a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, typing, protocol, runtime-checkable

Do not rely on isinstance(obj, MyProtocol) to validate signatures; use a static checker like mypy for that. Run on Python 3.12.3: with @runtime_checkable class RP(Protocol): def f(self, x: int) -> int, a class whose f(self) returns a string made isinstance(Impl(), RP) return True. Without @runtime_checkable the same isinstance call raised TypeError: Instance and class checks can only be used with @runtime_checkable protocols. I did not run mypy.
