Next: The string module
Up: Using Modules
Previous: Namespaces
  Contents
While not very useful in creating working applications, python provides you
with a number of functions which are useful for getting information about the
modules (and their corresponding namespaces) that you're using in your program.
The dir function returns a list containing all of the names defined
within a module. With no arguments, it is equivalent to the locals
function; given a module name, it displays the the names defined in that
module. The globals function does the same thing for names defined
in the global environment. The vars function works similarly, but
returns a dictionary whose keys are the names of the objects defined in a
module, and whose values are the objects themselves.
The help function, mentioned briefly in Section
, can
be passed a module name to get an overview of the use of the module. Recall
that this function is only available when running python interactively.
Phil Spector
2003-11-12