guide to introspecting python?

Mark Harrison mh at
Wed Aug 4 01:08:36 CEST 2004

What's a good document to read in order to understand some
of python's introspective functions?

I'm trying to recurse through a module and print information
about its contents.  dir() does something similar to what
I have in mind, but it's documented to be more for human
interaction than definitive programmatic correctness,
so I'd like to call or look at whatever it's using.

This bit of code never finishes because dir(something)
and dir(something.__call__) return the same thing.

def rdir(item, v=""):
    print "%s%s"%(v,item)
    for i in dir(item):
        rdir(i, v+"    ")

import os

Any help/pointers appreciated!


PS, you will probably recognize this as my attempt to
generate programatically the module/function/parameter
index I previously asked about...

Mark Harrison
Pixar Animation Studios

More information about the Python-list mailing list