One of the great things of python is the ability to have introspection on methods and functions. As an example, to get the function signature of math.log
you can (in ipython) run this:
In [1]: math.log?
Type: builtin_function_or_method
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function log>
Namespace: Interactive
Docstring:
log(x[, base])
Return the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.
And see that x
and optionally base
are the parameters of this function.
With the new gtk3 and the automaticall generated pygobject bindings, I can in all examples I tried only ever get (*args, **kwargs)
as the parameters of every gtk method.
Example: Label.set_text which requires a string:
In [1]: from gi.repository import Gtk
In [2]: mylabel = Gtk.Label("hello")
In [3]: mylabel.set_text?
Type: instancemethod
Base Class: <type 'instancemethod'>
String Form: <bound method Label.set_text of <Label object at 0x275b230 (GtkLabel at 0x28cd040)>>
Namespace: Interactive
File: /usr/lib/python2.7/dist-packages/gi/types.py
Definition: L.set_text(*args, **kwargs)
Docstring:
<no docstring>
NOW THE QUESTION: is this (the loss of method introspection for python bindings) something that will change once more (documentation) effort has gone into pygobjects or is this something that is here to stay due to the way pygobjects works?