Re: Writing __doc__ strings for a C module?

Guido.van.Rossum@cwi.nl
Sun, 02 Apr 1995 11:33:54 +0200

> Is there any facility for writing __doc__ strings in a module
> written in C, or do I have to manually provide the __doc__ member for
> the module and each object of this module that I write? I'm using
> Python 1.2 beta 4, whose version number still says beta 3 :)

The __doc__ string for the whole module can be set at module
initialization time by calling initmodule4() (Py_InitModule4() in the
new naming scheme) instead of initmodule() (Py_InitModule()).

The __doc__ string for individual functions and methods can be set as
the 4th element of the struct methodlist (PyMethodDef) initializer.

See Modules/newmodule.c for an example (still in the old naming
scheme).

Or were you thinking of a higher level facility, such as automatic
comment processing?

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>