问题
I have to analyze methods a foreign API, and how I usually do it it to write a test script, or find an example code, do a
ipdb.set_trace()
Where I want to experiment, and than take a look at currently available variables, objects and their methods. However, when I want to check the documentation the way Ipython offers
object.method?
I get
*** SyntaxError: invalid syntax (<stdin>, line 1)
If I try
help(object.method)
It gives
*** No help on (object.method)
Does that mean that there is no documentation for the selected method, or am I using the wrong way of calling it?
回答1:
The help()
function is actually a wrapper around pydoc.help()
which means that you can do something like:
ipdb> import math
ipdb> import pydoc
ipdb> pydoc.help(math.log)
回答2:
Actually !help(object.method)
works, you just need to signify with !
that it's a python command, not ipdb help command. Though convenient question mark doesn't work that way unfortunately.
来源:https://stackoverflow.com/questions/12455374/ipdb-and-method-documentation