How to reset document string

Diez B. Roggisch deets at nospam.web.de
Fri Aug 7 06:17:50 EDT 2009


Anand K Rayudu schrieb:
> Dear All,
> 
> We have extended and embedded python into my our application.
> We exposed few APIs to python using
> 
> Py_InitModule("myModuleName", myMethods);
> where my methods are
> 
> static PyMethodDef VistaDbMethods[] = {
>   { (char *)"myAPI",_myAPICFunctionPtr ,METH_VARARGS,"usage: MyHelp)" }
> 
> 
> Now problem is ml_doc (Document string). Most of the time the strings 
> given by development team is not descriptive enough, so support team 
> want to enhance these docstring on need basis and supply to customer
> The idea is we will provide get latest help option from application, 
> which will contact our webserver or allow user to pick new help 
> document,  which will re apply the help on fly.
>  From then on our script editors will show the new enhanced help.
> How do I achieve this.
> 
> I tried to change <Module>.<MyAPI>.__doc__ = "My new doc"
> 
> This failles as it is read only attribute.
> 
> Another approach could be calling  Py_InitModule("myModuleName", 
> myMethods); with new help string. But It is not working,
> So I am not sure what is the right way to do it

To put the right docstrings into the embedded interpreter. I don't know 
about your processes, but either the support just suggests better 
strings & developers put them in there, or maybe some sort of shared 
header-file could be used that the developers use & support enhances. 
Something like this:


--- docstrings.h ---

#define VistaDbMethods__doc__ "usage: MyHelp"


And if that's enhanced over time by the support-staff, docs will get 
better. Hopefully.

Alternatives are:

  - beating your developers with a clue-stick into submission that good 
docs are important
  - write a usage-guide using e.g. sphinx and release that as add-on-docs.

Diez



More information about the Python-list mailing list