Issue 15865: reflect bare star * in function signature documentation
Created on 2012-09-05 00:42 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue-15865-1.patch | chris.jerdonek, 2012-09-05 15:30 | review | ||
| issue-15865-2.patch | chris.jerdonek, 2012-09-08 01:10 | review | ||
| Messages (9) | |||
|---|---|---|---|
| msg169850 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-09-05 00:42 | |
This issue is to make sure that the bare * in the function signatures of pure Python functions is properly reflected in the documentation. This will bring the signatures in the documentation closer to the signatures that we have in the Python code -- a goal articulated by Ezio in a comment to issue 15831. For example, configparser.RawConfigParser() has this function signature: def __init__(self, defaults=None, dict_type=_default_dict, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=DEFAULTSECT, interpolation=_UNSET): But its documentation has no *: class configparser.RawConfigParser(defaults=None, dict_type=collections.OrderedDict, allow_no_value=False, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configaparser.DEFAULTSECT, interpolation=None) (from http://docs.python.org/dev/library/configparser.html#configparser.RawConfigParser ) From a search of the code, there are about 60 occurrences of a bare * in the signature of a pure Python function (not all of which will need to be updated). |
|||
| msg169872 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2012-09-05 14:49 | |
So is the root problem that Sphinx does not handle keyword-only arguments? |
|||
| msg169874 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-09-05 14:58 | |
> So is the root problem that Sphinx does not handle keyword-only arguments? I don't think so. Sphinx renders the * just fine. It's just that in some of the reST files, the * was left out. |
|||
| msg169876 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-09-05 15:30 | |
Actually, it looks like configparser is the *only* file with missing single *'s. :) However, I did find a few other typos in the process of checking those signatures in the other files. Patch attached. |
|||
| msg170012 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2012-09-07 21:07 | |
By looking at x.py, I confirmed that the added stars are correct.
Also, the correction of 'header' to 'hdr' is correct.
However, for threading.py in 3.3.0, I see
class Thread:
...
def __init__(self, group=None, target=None, name=None,
args=(), kwargs=None, *, daemon=None):
whereas the patch and existing .rst
-.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={},
+.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}, \
verbose=None, *, daemon=None)
has an extra 'verbose=None' that should be removed there and in any explanatory text that follows.
(The fact that we found 2 doc signature errors other than the 4 missing *s suggests that we need a tool to systematically compare doc signature to code signature.)
|
|||
| msg170013 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-09-07 21:43 | |
Thanks, Terry. If anyone is curious, it looks like the verbose keyword argument was added to the docs (and to threading.py) in revision f71acc4b2341, and then subsequently removed (but not from the docs) in revision 8ec51b2e57c2. > (The fact that we found 2 doc signature errors other than the 4 missing *s suggests that we need a tool to systematically compare doc signature to code signature.) Out of curiosity, can anyone summarize what our existing tooling might already be able to do in this regard (e.g. Sphinx or pydoc)? I will update the patch. |
|||
| msg170020 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-09-08 01:10 | |
Here is an updated patch that incorporates Terry's suggestion. |
|||
| msg170060 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2012-09-08 17:53 | |
New changeset a30b3915228b by Ezio Melotti in branch '3.2': #15865: add "*" in the signature to document keyword-only args in the docs. Patch by Chris Jerdonek. http://hg.python.org/cpython/rev/a30b3915228b New changeset 694c725f241a by Ezio Melotti in branch 'default': #15865: merge with 3.2. http://hg.python.org/cpython/rev/694c725f241a |
|||
| msg170061 - (view) | Author: Ezio Melotti (ezio.melotti) * ![]() |
Date: 2012-09-08 17:54 | |
Fixed, thanks for the patch! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:35 | admin | set | github: 60069 |
| 2012-09-08 17:54:53 | ezio.melotti | set | status: open -> closed messages: + msg170061 assignee: docs@python -> ezio.melotti |
| 2012-09-08 17:53:10 | python-dev | set | nosy:
+ python-dev messages: + msg170060 |
| 2012-09-08 01:10:53 | chris.jerdonek | set | files:
+ issue-15865-2.patch messages: + msg170020 |
| 2012-09-07 21:43:08 | chris.jerdonek | set | messages: + msg170013 |
| 2012-09-07 21:07:54 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg170012 |
| 2012-09-05 15:38:03 | chris.jerdonek | set | keywords:
+ needs review stage: needs patch -> patch review |
| 2012-09-05 15:30:53 | chris.jerdonek | set | files:
+ issue-15865-1.patch keywords: + patch messages: + msg169876 |
| 2012-09-05 14:58:46 | chris.jerdonek | set | messages: + msg169874 |
| 2012-09-05 14:49:01 | eric.araujo | set | messages:
+ msg169872 versions: + Python 3.2 |
| 2012-09-05 09:38:58 | ezio.melotti | set | nosy:
+ georg.brandl, eric.araujo stage: needs patch |
| 2012-09-05 00:42:31 | chris.jerdonek | create | |

