On Sun, 06 Dec 2009 06:34:17 -0600, Tim Chase wrote: >> * He hasn't actually defined a docstring. Docstrings have to be string >> literals, you can't do this: >> >> """%s does everything you could possibly want.""" % "xyz" > > I've occasionally wanted something like this, and have found that it can > be done by manually assigning to __doc__ (either at the module-level or > classes) which can make some documentation bits a little easier:
Unfortunately, and surprisingly, assigning to __doc__ doesn't work with new-style classes. >>> class K(object): ... pass ... >>> K.__doc__ is None True >>> K.__doc__ = "docstring" Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: attribute '__doc__' of 'type' objects is not writable -- Steven -- http://mail.python.org/mailman/listinfo/python-list