In Python, docstrings are used to document the purpose and usage of a module, class, method, or function.
There are two types of docstrings in Python:
Single-line docstrings are enclosed in triple quotes on a single line, immediately preceding the class, function, or method definition:
main.py127 chars5 lines
Multi-line docstrings are used when more detailed documentation is needed. They are enclosed in triple quotes on multiple lines, with an extended summary, parameters, and return value (if applicable):
main.py256 chars10 lines
Note that the format of multi-line docstrings is not enforced by the Python interpreter, but there are documentation tools like Sphinx that can parse and generate documentation based on them.
gistlibby LogSnag