New submission from Serhiy Storchaka:

Here are two patches which implementation two different interface for same 
feature.

In first patch you can use *doc* and *field_docs* arguments to specify 
namedtuple class docstring and field docstrings. For example:

    Point = namedtuple('Point', 'x y',
                       doc='Point: 2-dimensional coordinate',
                       field_docs=['abscissa', 'ordinate'])

In second patch you can use *doc* argument to specify namedtuple class 
docstring and *field_names* argument can be a sequence of pairs: field name and 
field docstring. For example:

    Point = namedtuple('Point', [('x', 'absciss'), ('y', 'ordinate')],
                       doc='Point: 2-dimensional coordinate')

What approach is better?

Feel free to correct a documentation. I know that it need a correction.

----------
components: Library (Lib)
files: namedtuple_docstrings_field_docs.patch
keywords: patch
messages: 177381
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Docstrings for namedtuple
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file28294/namedtuple_docstrings_field_docs.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16669>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to