A docstring is any string literal that appears as the first statement in a class, method, function, or module. Stylistically, itβs typical and preferable to use a triple quote format, which allows you to use longer, better formatted docstrings and draw attention to them to simplify the links, but any string will match.
Docstrings are different from comments because comments are not related to program execution at all, while docstrings are available at run time by accessing the __doc__ object __doc__ .
source share