These are used by python's documentation tools to extract documentation from running objects by importing and examining __doc__ of objects, instead of extracting docs from comments like Java or c++ doxygen. It also makes it easier to document python modules written in c since you just attach their docstrings and examine them at runtime same as any python module
Either pythons stdlib crappy pydoc module
`python -m pydoc -w ModuleName`
the simple pdoc tool
`/path/to/pdoc --html ModuleName`
or the complicated and fully featured sphinx (too complicated for a single command
`sphinx-apidoc ModuleName` to generate a default project
and `make`/`make.bat` to run it
)
They are also useful print help in repl (with `help(obj)` or `obj?` in IPython)
Also in python comments are everything after a hash # till end of line.
Non assigned Literal strings in python are just literal objects not comments.
If they are the first thing in a class/function they become the class/function/method __doc__ attribute.
If they aren't they have no use but are simply created and then garbage collected because there are no references pointing to them(cpython the default python implementation uses reference counting and the occasional cleanup of unreachable cycles so it would be deleted right after creation). Its the same with literal numbers or dictionaries.
def a():
5
[]
"whoop de do"
is a legal (and totally pointless) python function that will do nothing(other then allocate then cleanup some objects).