Serhiy Storchaka <> added the comment:

I prefer 2 or 3. There are benefits from representing a docstring as a separate 
attribute. This simplifies the code for walking the AST tree (no longer special 
cases for skipping docstring in modules, classes and functions) and the code 
for retrieving a docstring. It solves the problem that an expression resulting 
to a constant string (like "a"+"b" or f"a") shouldn't be interpreted as 

The position of a docstring can be useful for determining the position of 
fragments inside a docstring (for example for doctests). Several active 
developed third-party libraries (like pyflakes, see already updated their code for 
supporting 3.7. The position of nodes preceding or following a docstring could 
be used. This is not perfect, it doesn't work with empty lines before or after 
docstring, but it never was perfect due to escaped newlines in string literals 
and line continuations.


Python tracker <>
Python-bugs-list mailing list

Reply via email to