How to create a docstring for a module?

Paul McGuire ptmcg at austin.rr.com
Sun Dec 6 14:03:07 EST 2009


On Dec 6, 7:43 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sun, 06 Dec 2009 06:34:17 -0600, Tim Chase wrote:
> > 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.
>
> --
> Steven

Fortunately, in the OP's case, he isn't trying to do this with a
class, but with a module.  For me, assigning to __doc__ at the module
works in defining a docstring for pyparsing, at least for Py2.5.

-- Paul



More information about the Python-list mailing list