question about introspection using inspect module

Fernando Perez fperez.net at gmail.com
Thu Jul 7 13:30:19 EDT 2005


Benjamin Rutt wrote:

> I'm trying to learn about introspection in Python.  my ultimate goal
> is to be able to build a module "text database" of all modules that
> are in the sys.path, by discovering all candidate modules (I've
> already done that), importing all of them, and then introspecting on
> each module to discover its functions, globals and classes.  But for
> now I am having a problem with the latter.

I certainly don't want to discourage you from learning about python
introspection, it's one of the most fun aspects of the language.  But just as
an FYI, the pydoc system already does much of what you have in mind, at least
if I'm reading your description correctly:

planck[/tmp]> pydoc -p 12345
pydoc server ready at http://localhost:12345/


Just point your favorite webbrowser to that URL (use any port number you want,
and which isn't already in use).

Cheers,

f




More information about the Python-list mailing list