Author serhiy.storchaka
Recipients Mark.Shannon, benjamin.peterson, georg.brandl, inada.naoki, ned.deily, rhettinger, serhiy.storchaka, vstinner
Date 2018-02-23.11:19:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519384783.9.0.467229070634.issue32911@psf.upfronthosting.co.za>
In-reply-to
Content
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 docstrings.

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 https://github.com/PyCQA/pyflakes/pull/273) 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.
History
Date User Action Args
2018-02-23 11:19:43serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, rhettinger, vstinner, benjamin.peterson, ned.deily, inada.naoki, Mark.Shannon
2018-02-23 11:19:43serhiy.storchakasetmessageid: <1519384783.9.0.467229070634.issue32911@psf.upfronthosting.co.za>
2018-02-23 11:19:43serhiy.storchakalinkissue32911 messages
2018-02-23 11:19:43serhiy.storchakacreate