astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Astropy Core Package Utilities (`astropy.utils`) »
- InheritDocstrings

# InheritDocstrings

class `astropy.utils.misc.``InheritDocstrings`(name, bases, dct)

  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
      >>> from astropy.extern import six
      >>> @six.add_metaclass(InheritDocstrings)
      ... class A(object):
      ...     def wiggle(self):
      ...         "Wiggle the thingamajig"
      ...         pass
      >>> class B(A):
      ...     def wiggle(self):
      ...         pass
      >>> B.wiggle.__doc__
      u'Wiggle the thingamajig'