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 <[email protected]>
<http://bugs.python.org/issue16669>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com