Suppose I have an interface A
with a single function.
class A(metaclass=ABCMeta):
@abstractmethod
def spam(self, x: int) -> str:
pass
There are classes B
and C
that implement this interface, but they will not be directly initialized. I will have some factory method (say) that will return to me a suitable object implementing A
. So in this case, when I implement spam
in B
and C
, should I repeat the type hints? Practically, since B
and C
aren't directly used, the type hints for A
seem sufficient. But I'm curious about the best practice in this situation; and if there are other issues to be considered.