Closed
Description
class Foo:
def __call__(self, instance) -> A:
...
foo = typeclass(Foo)
...
class Bar:
def __call__(self, instance) -> B:
...
bar = typeclass(Bar)
...
def fn(instance: Supports[Foo, Bar]) -> C:
...
This is similar to #83 and python/typing#213, but offers the advantages of composability and conciseness.
I'd be willing to have a go at implementing this but I'm not very familiar with mypy plugins (where I suspect most of the work would be required).