I have an abstract class structured somewhat like this:
class AbstractQuery(object, zip_code): def execute(self): """ Retrieve information about a zip code The information returned will depend on the subclass """ url, params = self._build_query(zip_code) response = requests.get(url, params=params) if self._is_valid(response): # etc. def _build_query(self, zip_code): """ Returns a tuple (url, params) where url is the url of the API to query and params are the query params for the API call """ raise NotImplementedError def _is_valid(self, response): """ Returns True if response contains information necessary to continue processing """ raise NotImplementedError
_build_query for example is always going to do the same thing, there's just going to be minor implementation differences. Do I just keep the docstring in the base class? Or copy/paste it down and violate DRY? What would a user or maintainer of these classes want to see?