8

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?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143

2 Answers2

9

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.

bravmi
  • 505
  • 2
  • 7
  • 13
6

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)
Daniel
  • 26,899
  • 12
  • 60
  • 88