bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / _lib / doccer / inherit_docstring_from
function
scipy._lib.doccer:inherit_docstring_from
source: build-install/usr/lib/python3.14/site-packages/scipy/_lib/doccer.py:82
Signature
def inherit_docstring_from(cls: object) → DecoratorSummary
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__
✗'Do something useful.\nDo it fast.\n'
Aliases
scipy.stats._continuous_distns.inherit_docstring_from