Documenting extension modules?

Robert Kern rkern at ucsd.edu
Fri Jul 15 06:49:23 EDT 2005


Francois De Serres wrote:
> Hiho,
> 
> I can't seem to find a proper way to document my extension module. 
> Following the C API doc:
> 
> static PyMethodDef ioMethods[] = {
>     {"o_count",  o_count, METH_VARARGS, "Return the count of available 
> MIDI outputs."},
> ....
> }
> 
> lacks:
> a) module level documentation

In your init<module> function, assign a PyStr object to __doc__.

> b) function parameters

Add that information to your docstring. I don't think that there is a 
way to get this information via inspect.

> Also, I'd like to know if there's a typical format for the help string 
> (but in C), compatible with docstring's
> """short desription
> 
> long description"""

char *o_count__doc__;
char *o_count__doc__ = "short description\n"\
"\n"\
"long description\n";

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list