A docstring of function foo is the public information that someone sees if
they type help(foo). Sympy is full of such docstrings; try type
help(prime), for example, and compare what you see on screen with what is
in the file sympy.ntheory.generate.prime.

A comment is something that a person reading the code will see and usually
begins with a hash sign. They might be "inline" comments

offset -= 1  # correct offset for screen error

or a standalone line or block

# handle odd and even cases
if n % 2 == 0:
     blah, blah
else:
     blah blah blah

(Mul.flatten has lots of blocks of comments that you can look at.)