How to Write Docstrings in Python - Real Python
Briefly

Python docstrings are string literals that document functions, classes, methods, and modules. They are placed immediately after the definition line and are commonly enclosed in triple double quotes. PEP 257 outlines conventions for writing docstrings but does not enforce a single formal style. Docstrings are distinct from comments: comments begin with # and are ignored by the interpreter, while docstrings are stored on the object in __doc__ and accessible at runtime. Docstrings provide documentation for users and tools and can be used to generate or access documentation programmatically. Comments explain implementation details for developers and can appear anywhere in code.
Python docstrings are string literals that show information regarding Python functions, classes, methods, and modules, allowing them to be properly documented. They are placed immediately after the definition line in triple double quotes ("""). Their use and convention are described in PEP 257, which is a Python Enhancement Proposal (PEP) that outlines conventions for writing docstrings. Docstrings don't follow a strict formal style. Here's an example:
Python comments and docstrings seem a lot alike, but they're actually quite different in a number of ways because they serve different purposes: CommentsDocstrings Begin with # Are enclosed in triple quotes (""") Consist of notes and reminders written by developers for other developers Provide documentation for users and tools Are ignored by the Python interpreter Are stored in .__doc__ and accessible at runtime
Read at Realpython
[
|
]