[Python-ideas] Docstrings for namedtuple
Eli Bendersky
eliben at gmail.com
Sun Dec 16 14:22:44 CET 2012
More information about the Python-ideas mailing list
Sun Dec 16 14:22:44 CET 2012
- Previous message: [Python-ideas] Docstrings for namedtuple
- Next message: [Python-ideas] Docstrings for namedtuple
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Dec 12, 2012 at 9:40 AM, Serhiy Storchaka <storchaka at gmail.com>wrote: > What interface is better for specifying namedtuple field docstrings? > > Point = namedtuple('Point', 'x y', > doc='Point: 2-dimensional coordinate', > field_docs=['abscissa', 'ordinate']) > > or > > Point = namedtuple('Point', [('x', 'absciss'), ('y', 'ordinate')], > doc='Point: 2-dimensional coordinate') > > ? > > This may be a good time to say that personally I always disliked namedtuple's creation syntax. It is unpleasant in two respects: 1. You have to repeat the name 2. You have to specify the fields in a space-separated string I wish there was an alternative of something like: @namedtuple class Point: x = 0 y = 0 Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121216/80cf1a35/attachment.html>
- Previous message: [Python-ideas] Docstrings for namedtuple
- Next message: [Python-ideas] Docstrings for namedtuple
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list