Top "Docstring" questions

A docstring is a string that occurs as the first statement in a module, function, class, or method definition, and is used to document the object in which it occurs.

Utilizing docstrings

It's a newbie question, but I didn't manage to google anything reasonably concise yet enlightening on the subject. I've got …

javascript node.js docstring
How do I reference a documented Python function parameter using Sphinx markup?

I'd like to reference a previously-documented function parameter elsewhere in a Python docstring. Consider the following (admittedly completely artificial) example: …

python python-sphinx docstring
Docstrings - one line vs multiple line

I'm adding some (epydoc) documentation to a package I've written, and I'm coming across a lot of instances where I'm …

python documentation docstring
How to write meaningful docstrings?

What, in Your opinion is a meaningful docstring? What do You expect to be described there? For example, consider this …

python comments docstring
Documenting `tuple` return type in a function docstring for PyCharm type hinting

How can I document that a function returns a tuple in such a way that PyCharm will be able to …

python pycharm docstring
Custom PyCharm docstring stubs (i.e. for google docstring or numpydoc formats)

Does PyCharm 2.7 (or will PyCharm 3) have support for custom docstring and doctest stubs? If so, how does one go about …

python pycharm docstring doctest sphinx-napoleon
Is there a consensus what should be documented in the classes and __init__ docstrings?

I did not find any best practice about what should be documented in the classes and __init__ docstrings. Sometimes I …

python docstring code-documentation
How to specify different return types in python docstring

I'm currently writing documentation for my python package using Sphinx and the autodoc plugin. For a function return value I …

python python-sphinx docstring autodoc
How should unit tests be documented?

I'm trying to improve the number and quality of tests in my Python projects. One of the the difficulties I've …

python unit-testing documentation docstring