Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Allow blank lines after multi-line function docstrings #361

@anntzer

Description

@anntzer

Currently, pydocstyle warns by default when a function docstring is followed by a blank line (D202). However, a careful reading of PEP257 indicates that this rule should only apply to one-line docstrings, not to multiline docstrings: the sole sentence regarding this, "There's no blank line either before or after the docstring.", occurs in the "One-line docstrings" section, immediately after the "The closing quotes are on the same line as the opening quotes. This looks better for one-liners." sentence which clearly only applies to one-line docstrings. Allowing an empty line after the function docstring also makes sense if e.g. the function body contains empty lines: in something like

def func():
    """
    Some docstring.

    Some more stuff.
    """
    do_this()
    do_that()

    do_this_again()
    do_that_again()

if there's no empty line after the docstring, I personally feel the docstring "binds" too closely to the first part of the body at the expense of the second part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions