template-method-pattern

Inheriting methods' docstrings in Python

Inheriting methods' docstrings in Python Question: I have an OO hierarchy with docstrings that take as much maintenance as the code itself. E.g., class Swallow(object): def airspeed(self): “””Returns the airspeed (unladen)””” raise NotImplementedError class AfricanSwallow(Swallow): def airspeed(self): # whatever Now, the problem is that AfricanSwallow.airspeed does not inherit the superclass method’s docstring. I know I …

Total answers: 6