import sys from typing import Any, Protocol, runtime_checkable class Concrete: def __init__(self, x): self._x = x @property def x(self): if self._x is None: raise RuntimeError(f'raised from {self}') return def check(klass): isinstance(Concrete(0), klass) isinstance(Concrete(None), klass) check(Concrete) # this is trivial @runtime_checkable class Proto1(Protocol): @property def x(self): ... check(Proto1) @runtime_checkable class Proto2(Protocol): x: Any check(Proto2) if sys.version_info >= (3, 9): @runtime_checkable class Proto3(Protocol): @classmethod @property def x(cls): raise RuntimeError(f'raised from {cls}') check(Proto3)