7

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
  • 11,360
  • 21
  • 88
  • 132
sholsapp
  • 14,714
  • 10
  • 46
  • 64

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
  • 52,449
  • 19
  • 137
  • 227
4

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

nate c
  • 8,374
  • 2
  • 25
  • 26