Skip to content

Recommend r"""docstring""" over """docstring""" #25998

@MareoRaft

Description

@MareoRaft
mannequin

The general conventions webpage https://doc.sagemath.org/html/en/developer/coding_basics.html#latex-typesetting says that both docstring syntaxes (r"""docstring""" and """docstring""") are valid (which is true), but fails to recommend one over the other.

Since it is a conventions webpage, I think it is appropriate to recommend r"""docstring""" over the latter here. The r convention is nicer because you don't need double backslashes in latex code, which is shorter and makes it easier to copy latex code from docstrings to a latex document and vice-versa. Moreover, the webpage says that we follow the PEP257 conventions (https://www.python.org/dev/peps/pep-0257/) which themselves say 'Use r"""raw triple double quotes""" if you use any backslashes in your docstrings.'

Happy to make the changes myself once everyone is on board.

Component: documentation

Keywords: convention, raw

Author: Matthew Lancellotti

Issue created by migration from https://trac.sagemath.org/ticket/25998

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions