Have a look at Tim Peter's fabulous doctest module: ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/System/doctest.py ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/System/doctest.README 0.9.5 is the latest version I found. Maybe there's a newer one? Stefan