Someone at Canonical (I don’t know who) wrote something cool once to get Pyflakes (the best Python linter) to run on doctests.
It has recently been deleted from the Launchpad tree, but since it’s so useful I thought I’d make it available.
Download pyflakes-doctest whenever you’d like. If you can get it into Pyflakes trunk, then you’ll become even more wonderfully, deliciously fabulous and creamy than you undoubtedly are already. Get rid of the Launchpad-specific stuff though.