bundles / scipy 1.17.1 / scipy / _lib / doccer / inherit_docstring_from
function
scipy._lib.doccer:inherit_docstring_from
source: /scipy/_lib/doccer.py :82
Signature
def inherit_docstring_from ( cls : object ) → Decorator Summary
This decorator modifies the decorated function's docstring by replacing occurrences of '%(super)s' with the docstring of the method of the same name from the class cls.
Extended Summary
If the decorated method has no docstring, it is simply given the docstring of `cls`s method.
Parameters
cls: type or objectA class with a method with the same name as the decorated method. The docstring of the method in this class replaces '%(super)s' in the docstring of the decorated method.
Returns
decfunc: functionThe decorator function that modifies the __doc__ attribute of its argument.
Examples
In the following, the docstring for Bar.func created using the docstring of `Foo.func`.class Foo: def func(self): '''Do something useful.''' return class Bar(Foo): @inherit_docstring_from(Foo) def func(self): '''%(super)s Do it fast. ''' return b = Bar()✓
b.func.__doc__
✗Aliases
-
scipy.stats._continuous_distns.inherit_docstring_from