# InheritDocstrings¶

class astropy.utils.misc.InheritDocstrings(name, bases, dct)[source]

Bases: type

This metaclass makes methods of a class automatically have their docstrings filled in from the methods they override in the base class.

If the class uses multiple inheritance, the docstring will be chosen from the first class in the bases list, in the same way as methods are normally resolved in Python. If this results in selecting the wrong docstring, the docstring will need to be explicitly included on the method.

For example:

>>> from astropy.utils.misc import InheritDocstrings
>>> class A(metaclass=InheritDocstrings):
...     def wiggle(self):
...         "Wiggle the thingamajig"
...         pass
>>> class B(A):
...     def wiggle(self):
...         pass
>>> B.wiggle.__doc__
u'Wiggle the thingamajig'