I have a suite of similar classes called 'Executors', which are used in the Strategy pattern. They are very simple classes:
class ExecutorA:
def execute(self, data):
pass
class ExecutorB:
def execute(self, data):
pass
The execute()
functions of all executors need to behave in the same way, i.e. take data in a certain format and return data in another certain format. Due to duck-typing, there is no need to have a base class, so I didn't write one.
However, I am currently documenting my code using docstrings etc. and I thought it could be a good idea to document the data format requirements of the execute()
functions in an abstract base class like so:
class Executor(ABC):
def execute(self, data):
"""Process data in format xy and return data in format zy"""
pass
My rationale is that I don't want to replicate the same documentation in every Executor class. Is this a common use case for ABC's?
Clarification: I need to use python 3.6 because we are using RHEL and a newer python is not yet officially available.