from typing import SupportsInt
class C1():
def __int__(self) -> int:
return 42
class C2(C1):
pass
>>>c = C2()
>>>print(int(c))
42
>>>print(isinstance(c, C1))
True
>>> type(typing.SupportsInt)
<class 'typing._ProtocolMeta'>
But for this it fails
>>> isinstance(5, typing.SupportsInt)
...
TypeError: Protocols cannot be used with isinstance().
There is a similar question but no answers