Skip to content

First string token is always considered as docstring #7595

@dhruvmanila

Description

@dhruvmanila

In the docstring detection state machine, the first string token is always considered as docstring without considering the context. For example, the first strings in the following example are considered as docstrings:

"abcba".strip("ab")

On the opposite end, if multiple strings are implicitly concatenated then only the first string is considered as docstring:

"first" "second"

Python considers the entire string ("firststring") as the module docstring but the state machine will only say that "first" is docstring while "second" is a normal string.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocstringRelated to docstring linting or formatting

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions