Replace `#` comments with modern docstrings when possible
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
In string.Formatter.{parse,get_field}, we use simple # comments to document methods. While it's picked up by pydoc (through inspect.getcomments()), it's not picked up by IDEs. I suggest we cleanup those occurrences to improve code readability as well. I stumbled upon it by chance so there might be other places that need such cleanup.
[!IMPORTANT]
Only comments that are above adefof a public function should be considered. Comments inside the function body or method body should be considered separately as it could also mean that the public API is incompletely documented on purpose (see https://github.com/python/cpython/issues/134082#issuecomment-2887461014 and following).
- Report including private names: https://gist.github.com/picnixz/d4aa5ff5e82013966dc575f0709c4398#file-full-report-md
- Report for publicly-named API: https://gist.github.com/picnixz/d4aa5ff5e82013966dc575f0709c4398#file-report-md
Both reports parse private files as well as they can be re-exported to a public API. We still need to go through each occurrences to check if they are expected to be exposed or not (and thus the task is NOT an easy task for newcomers).
Linked PRs
- gh-134083
- gh-134096
- gh-134125
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the comments above string.Formatter.parse and get_field, then review the public-API and full reports linked in the issue. Check each reported occurrence against the rule for comments above public functions, including whether private names are re-exported. Done means the appropriate occurrences use modern docstrings while intentionally retained comments remain unchanged; linked PRs gh-134083, gh-134096, and gh-134125 already cover related work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100