Skip to content

Convention for multi-line type specifications #87

Open
@jnothman

Description

@jnothman

Parameter lists allow a specification like:

my_param : type specification
    Description

In some cases we at scikit-learn have had long type specifications that overflow into the next line under line-length conventions. From the perspective of documentation rendering, escaping the newline works:

my_param : a really really really really really really really long type \
        specification
    Description

(This is effective since Python evaluates the string literal and elides the escaped newline at parse time.)

However, PEP257 says:

Use r"""raw triple double quotes""" if you use any backslashes in your docstrings.

So I'm not sure we're doing the right thing. Is there a convention for overflowed type specifications? Should there be one hacked into the numpydoc parser (such as a hanging indent)?

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