Replies: 1 comment
-
As mentioned in IRC: Fixing style for style sake is |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal is a follow-up to yesterday's IRC discussion, it suggests standardizing docstrings across the PyPy codebase to follow PEP 257.
Current State
Docstring formatting is inconsistent across the project. Some parts like pycompiler, main or reverse_debugging follow PEP 257, while others don't or do incorrectly. Observed issues include:
For one-line docstrings:
Single string literal:
Even though neither CPython nor PyPy cares; any string literal can become a docstring when it's the first thing inside a module/class/function. PEP recommends using triple quotes, as this makes it easier to expand later.
pypy/pypy/interpreter/pyframe.py
Lines 705 to 707 in c2324b8
Incorrect formatting:
One-line docstrings should not have blank lines before or after them.
pypy/pypy/interpreter/pyframe.py
Lines 675 to 679 in c2324b8
Comment block used instead of a docstring:
In some places one-line docstring should be used, not a comment block.
pypy/pypy/interpreter/pyframe.py
Lines 640 to 642 in c2324b8
For multi-line docstrings:
Missing summary line and inconsistent blank lines:
Unless the entire docstring fits on a line, closing quotes should be on a line by themselves.
pypy/pypy/interpreter/executioncontext.py
Lines 399 to 403 in c2324b8
Inconsistent formatting:
Some files have varying formats for multi-line docstrings in the same section of code.
pypy/pypy/interpreter/executioncontext.py
Lines 427 to 433 in c2324b8
pypy/pypy/interpreter/executioncontext.py
Lines 462 to 471 in c2324b8
Proposal
Refactor all docstrings to comply with PEP 257. One-line docstrings should follow PEP 257's one-line docstrign format, and multi-line docstrings should follow PEP 257's multi-line docstring format.
Django is a good model example. Adopting a similar consistency in PyPy could improve readability and ease of contribution.
Only the documentation would be modified—no functional changes.
Q
Please let me know if there would be interest in these changes. If so, I can prepare a pull request.
Beta Was this translation helpful? Give feedback.
All reactions