Repository navigation
Replace stale signature lines in getopt docstrings with summaries - #162202
Conversation
It was copied from getopt() and named the wrong function, so help(getopt.gnu_getopt) showed "getopt(args, options[, long_options])".
|
|
||
| def gnu_getopt(args, shortopts, longopts = []): | ||
| """getopt(args, options[, long_options]) -> opts, args | ||
| """gnu_getopt(args, options[, long_options]) -> opts, args |
There was a problem hiding this comment.
The corrected line is still wrong, since the real parameters are shortopts and longopts, not options and long_options (getopt() has the same stale line). As help() already shows the actual signature, let's remove them from both docstrings instead.
|
Good point, thanks. I've removed the signature line from both the getopt() and gnu_getopt() docstrings, so help() shows only the real signature, and updated the title. |
getopt docstrings with summaries
|
Thanks @farisbasha for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-162232 is a backport of this pull request to the 3.15 branch. |
|
GH-162233 is a backport of this pull request to the 3.14 branch. |
|
The first line of the
getopt()andgnu_getopt()docstrings showed a stale signature,getopt(args, options[, long_options]) -> opts, args: the real parameters areshortoptsandlongopts, and thegnu_getopt()copy even named the wrong function. Sincehelp()already shows the actual signature, this removes those lines from both docstrings (as suggested in review).Trivial docstring fix, so no issue (as the PR template allows for typo-level changes). It was found and checked against
Lib/getopt.pywith the help of an AI assistant.