[issue16669] Docstrings for namedtuple
Ned Batchelder
report at bugs.python.org
Sun Dec 8 17:41:49 CET 2013
Ned Batchelder added the comment:
I'll add my voice to those asking for a way to put docstrings on namedtuples. As it is, namedtuples get automatic docstrings that seem to me to be almost worse than none. Sphinx produces this:
```
class Key
Key(scope, user_id, block_scope_id, field_name)
__getnewargs__()
Return self as a plain tuple. Used by copy and pickle.
__repr__()
Return a nicely formatted representation string
block_scope_id None
Alias for field number 2
field_name None
Alias for field number 3
scope None
Alias for field number 0
user_id None
Alias for field number 1
```
Why are `__getnewargs__` and `__repr__` included at all, they aren't useful for API documentation. The individual property docstrings offer no new information over the summary at the top. I'd like namedtuple not to be so verbose where it has no useful information to offer. The one-line summary is all the information namedtuple has, so that is all it should include in the docstring:
```
class Key
Key(scope, user_id, block_scope_id, field_name)
```
----------
nosy: +nedbat
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16669>
_______________________________________
More information about the Python-bugs-list
mailing list