Reputation: 2859
in pygtk when I set the label mylabel = gtk.Label("Hello World!")
I can get the string of label from it by mylabel.get()
method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get)
. Anyone know why?
Upvotes: 0
Views: 169
Reputation: 43041
It might be that what you wanted to ask was answered by @DonQuestion already... however if you truly just wanted to ask why help(gtk.Label.get)
doesn't return a help... the answer is actually very simple: because the get
method in the Label
object lacks a docstring in the source code. :)
In fact the call to help
doesn't generate an error, just an empty answer.
Upvotes: 2
Reputation: 40394
I recommend you to use ipython's dynamic object information is quite helpful when playing with some library in the interpreter or when debugging some code.
Aside from that, if you're using linux, installing the pygtk
documentation package is also very helpful because it integrates nicely with devhelp
, a tool that lets you browse and search the documentation easily.
Upvotes: 3
Reputation: 11614
Because the method gtk.Label.get
is an object itself, and has some attributes. The builtin function help
looks the __doc__
attribute and some other dictionaries of the object and the Class of the object up and returns them (formatted). You could do a help(help)
for example! ;-) so help(gtk.Label.get)
returns the attribute "__doc__
" of the method/object gtk.Label.get
and some other information gathered by class-introspection. It doesn't give you a help on the actual values of your gtk.Label
instance.
Upvotes: 3