Re: docstrings, module help, and default arguments



Comments below:

On Thu, Feb 14, 2013 at 2:23 PM, Niklas Koep <niklas koep gmail com> wrote:
I see. And I guess pulling in the docs from the associated gir files by default would kind of defeat the purpose of having typelibs in the first place, wouldn't it? What about doing it in IntrospectionModule.__dir__? That only gets called if the dir() built-in is invoked which happens to be what pydoc does to get the members of a module. Then again the __doc__ attribute of anything in the namespace would vary depending on whether dir() was invoked on the module before or not. How about only setting the __doc__ attribute when it is actually accessed?

If possible, I think having __doc__ as a lazily evaluated property (if gir files are available) would be the only reasonable way to do this simply for load time performance reasons. But first and foremost there needs to be general GI reference docs (and an API for it) before any work can be accomplished with dynamic Python docs.

This looks like it might be a bug with how the dynamic introspection module is appearing to pydoc. Please log it here: https://bugzilla.gnome.org/enter_bug.cgi?product=pygobject


Committed, thanks!
  
Optional arguments are currently not supported because there is no way to get defaults from the introspection API. See: https://bugzilla.gnome.org/show_bug.cgi?id=558620

-Simon

I came across this discussion on the pygtk mailing list dating back to 2011 which mentions a plan to store a serialized version of the default argument in typelibs: http://www.daa.com.au/pipermail/pygtk/2011-March/019489.html What happened to this idea?

There are patches for this in the bug I mentioned. It looks like the project needs to be picked up by someone and worked on a bit more.

-Simon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]