How can I list the methods in a Python 2.5 module? How can I list the methods in a Python 2.5 module? python python

How can I list the methods in a Python 2.5 module?


Here are some things you can do at least:

import moduleprint dir(module) # Find functions of interest.# For each function of interest:help(module.interesting_function)print module.interesting_function.func_defaults


Mark Pilgrim's chapter 4, which you mention, does actually apply just fine to Python 2.5 (and any other recent 2.* version, thanks to backwards compatibility). Mark doesn't mention help, but I see other answers do.

One key bit that nobody (including Mark;-) seems to have mentioned is inspect, an excellent module in Python's standard library that really helps with advanced introspection.


Just this is pretty good too:

import modulehelp(module)

It will print the docstring for the module, then list the contents of the module, printing their docstrings too.