Help text embedding in C code?

Carsten Haese carsten at uniqsys.com
Mon Jul 30 20:07:12 EDT 2007


On Mon, 2007-07-30 at 16:24 -0700, James Stroud wrote:
> Hello All,
> 
> I have a python module I wrote in C some time ago and I have since 
> forgotten how to use my functions and so I wanted to add some 
> doc-strings such that "help(function_name)" would give some help in the 
> interactive interpreter. [...] Is it possible to 
> embed this information in the C source directly [...] ?

Yes. A doc-string can be provided in the fourth slot of the PyMethodDef
entry. See e.g. /path/to/python/source/Modules/cPickle.c for a randomly
chosen module that has doc strings embedded in the C source.

HTH,

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list