Search code examples
pythonintrospectionpython-2.5

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


I'm trying to use a Python library written in C that has no documentation of any kind. I want to use introspection to at least see what methods and classes are in the modules. Does somebody have a function or library I can use to list the functions (with argument lists) and classes (with methods and member variables) within a module?

I found this article about Python introspection, but I'm pretty sure it doesn't apply to Python 2.5. Thanks for the help.


Solution

  • Here are some things you can do at least:

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