[issue16669] Docstrings for namedtuple

Eric Snow report at bugs.python.org
Thu Dec 13 17:59:08 CET 2012


Eric Snow added the comment:

What is wrong with the following?

class Point(namedtuple('Point', 'x y')):
    """A 2-dimensional coordinate

    x - the abscissa
    y - the ordinate

    """

This seems more clear to me.  namedtuple is in some ways a quick-and-dirty type, essentially a more true implementation of the intended purpose of tuple.  The temptation is to keep adding on functionality but we should resist until there is too much imperative.  I don't see it here.  While I don't have a gauge of how often people use (or would use) docstrings with nametuple, I expect that it's relatively low given the intended simplicity of namedtuple.

----------
nosy: +eric.snow

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16669>
_______________________________________


More information about the Python-bugs-list mailing list