modify_docstring¶
-
plasmapy.utils.decorators.helpers.
modify_docstring
(func=None, prepend: str = None, append: str = None)¶ A decorator which programmatically prepends and/or appends the docstring of the decorated method/function. The unmodified/original docstring is saved as the
__original_doc__
attribute.Parameters: Returns: Wrapped version of the function.
Return type: callable
Examples
>>> @modify_docstring(prepend='''Hello''', append='''World''') ... def foo(): ... '''Beautiful''' ... pass >>> foo.__original_doc__ 'Beautiful' >>> foo.__doc__ 'Hello\n\nBeautiful\n\nWorld'