8

Is there is a tool similar to dir() for modules that will tell me what parameters a given function takes? For instance, I would like to do something like dir(os.rename) and have it tell me what parameters are documented so that I can avoid checking the documentation online, and instead use only the Python scripting interface to do this.

tshepang
  • 12,111
  • 21
  • 91
  • 136
sholsapp
  • 15,542
  • 10
  • 50
  • 67

2 Answers2

12

I realize that you're more interested in help(thing) or thing.__doc__, but if you're trying to do programmatic introspection (instead of human-readable documentation) to find out about calling a function, then you can use the inspect module, as discussed in this question.

Community
  • 1
  • 1
Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
4

help(thing) pretty prints all the docstrings that are in the module, method, whatever ...

nate c
  • 8,802
  • 2
  • 27
  • 28