Is it possible to add a documentation string to a namedtuple in an easy manner?
I tried
from collections import namedtuple
Point = namedtuple(\"Poin
In Python 3, no wrapper is needed, as the __doc__ attributes of types is writable.
from collections import namedtuple
Point = namedtuple('Point', 'x y')
Point.__doc__ = '''\
A 2-dimensional coordinate
x - the abscissa
y - the ordinate'''
This closely corresponds to a standard class definition, where the docstring follows the header.
class Point():
'''A 2-dimensional coordinate
x - the abscissa
y - the ordinate'''
This does not work in Python 2.
AttributeError: attribute '__doc__' of 'type' objects is not writable.