Bug report
bytes.rsplit is a clone of bytes.split, their docstrings contain the same description of sep, but pydoc renders them differently:
| split(self, /, sep=None, maxsplit=-1) | rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the sections ... | Return a list of the sections ...
| |
| sep | sep
| The delimiter according which ... | The delimiter according which ...
The docstring of split ends with the parameter descriptions, so the smallest indentation of all lines after the first one is 2, and inspect.cleandoc() removes it. The docstring of rsplit has one more paragraph which starts at the column 0, so nothing is removed.
As a result the same description is 2 characters wider in rsplit, and rewrapping it in split does not help.
69 of the documentation strings which contain an indented block are dedented, and 97 are not.
Since 3.13 the compiler removes the indentation of docstrings written in the source code (#81283), so the dedenting in cleandoc() now only affects documentation strings where the indentation is meaningful, like those generated by Argument Clinic.
I propose to add a dedent parameter in inspect.cleandoc() and inspect.getdoc(), and to not dedent in pydoc.
Linked PRs
Bug report
bytes.rsplitis a clone ofbytes.split, their docstrings contain the same description ofsep, butpydocrenders them differently:The docstring of
splitends with the parameter descriptions, so the smallest indentation of all lines after the first one is 2, andinspect.cleandoc()removes it. The docstring ofrsplithas one more paragraph which starts at the column 0, so nothing is removed.As a result the same description is 2 characters wider in
rsplit, and rewrapping it insplitdoes not help.69 of the documentation strings which contain an indented block are dedented, and 97 are not.
Since 3.13 the compiler removes the indentation of docstrings written in the source code (#81283), so the dedenting in
cleandoc()now only affects documentation strings where the indentation is meaningful, like those generated by Argument Clinic.I propose to add a
dedentparameter ininspect.cleandoc()andinspect.getdoc(), and to not dedent inpydoc.Linked PRs