Re: [pygccxml-development] Py++ and docstrings for virtual method
Brought to you by:
mbaas,
roman_yakovenko
From: Scott S. <sc...@bi...> - 2011-03-14 20:07:56
|
Hi Roman, Thanks for the suggestion, but unfortunately I get the error that the attribute '__doc__' of 'instacemethod' objects is not writeable. No doubt this is due to my constructor being private as the class is not to be instantiated from python, only the methods are to be used. I guess unless I change the ctor to be public, I'm stuck without docstrings for virtual methods? Thank you for your help, Scott On Mon, 14 Mar 2011, Roman Yakovenko wrote: > On Mon, Mar 14, 2011 at 4:50 PM, Scott Sturdivant <sc...@bi...> wrote: >> >> Hi again py++ friends, > > Good evening > >> >> I had a question concerning docstrings for virtual methods. For a normal method, my docstring extractor is working great, resulting in bindings that generate looking like this: >> >> .def( >> "disableDebug" >> , (void ( ::myManager::* )( ) )( &::myManager::disableDebug ) >> , "disableDebug()\nDisable debug, returning the logging output to a sane level.") >> >> However, if the method is virtual, the generated wrapper looks more like this: >> >> .def( >> "getFoo" >> , (double ( ::myManager::* )( ) )(&::myManager::getFoo) >> , (double ( myManager_wrapper::* )( ) )(&myManager_wrapper::default_getFoo) ); >> >> In the call to the actual wrapper, no where is my method's documentation present. Is this a limitation of py++, or of boost python? > > At the time, I implemented that feature, Boost.Python did not support > docstring for them. What you can do is to generate a small Python > module, with doc strings and inject them into the method: > > import foo > foo.myManager.getFoo.__doc__ = <what ever> > > Than just ensure to import this module, right after the extension: > http://www.boost.org/doc/libs/1_46_1/libs/python/doc/tutorial/doc/html/python/techniques.html#python.extending_wrapped_objects_in_python > >> Thanks! > > You are welcome. > |