4 ms·
They are recommended for docstrings, but not for comments in general. The compiler has a special case if the first statement of a function/class/module is a str
by Kwpolska 4y ago
They are recommended for docstrings, but not for comments in general. The compiler has a special case if the first statement of a function/class/module is a string (doesn’t have to be multiline), and it puts that string in the __doc__ attribute of that function/class/module — those are docstrings, and they need to be something visible to the compiler.