docstrings, module help, and default arguments



Hey,

I have a couple of questions regarding gobject-introspection but with a direct focus on pygobject. Instead of cluttering the mailing list with multiple mails I thought I'd just post one. I hope that was alright.

I was under the impression that one of the many benefits of gobject-introspection was that in the case of generating dynamic python bindings we would also get automatically generated docstrings for functions, classes and methods based on annotations resp. gtk-docs. From my own tests, as well as from inspecting the dynamic bindings for gtk or gstreamer, it seems this is not the case though. Is this the intended behaviour?

Another issue I'm having is that functions defined in my module namespace won't show up in the help for my module, e.g. 

    python2 -c "from gi.repository import MyModule; help(MyModule)" 

doesn't list any of my implemented functions. They are properly annotated in the C-code as they are listed in the gir file and I can call them just fine from python. I noticed a similar behaviour for gstreamer functions. Functions listed in the Gst-1.0.gir file are callable from python, but not listed in the module's help text. Introspected classes, however, appear in the help text. Why is that?

Another thing I was wondering about is if default arguments for functions and methods are supported yet. Again, a gstreamer example: I've seen lots of code snippets like

    playbin = Gst.ElementFactory.make("playbin2")

on the net, even though according to the C documentation gst_element_factory_make requires you to pass two arguments to the function: the element you want to create and a unique name. The name argument is annotated with allow-none, but I still have to pass None as second argument if I call the method from python as otherwise a TypeError exception is raised. This is what I would consider correct behaviour, but I'm still wondering if all the code examples are simply erroneous or if I'm overlooking something.

Kind regards,
Niklas



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