You should never read the code to know what the library does.
That’s the job of the documentation or readme files, including docstrings.
Single-line Docstring
Quotations are on the same line.
def does_something(arg):
"""Takes one argument and does something to it based on type."""
pass
Multi-line Docstring
The closing quotation is on a new line.
def does_something(arg): """Takes one argument and does something to it based on type. If arg is a string, returns arg * 3; If arg is an int or float, returns arg + 10 """ pass
Usage
>>> help(docstrings.does_something) Takes one argument and does something to it based on type. If arg is a string, returns arg * 3; If arg is an int or float, returns arg + 10
Comment with Docstrings
You can use docstrings to comment multiple lines of code.
But that is NOT a recommended practice as it may lead to confusion.