[Python-Dev] More pydoc questions

Jeff Epler jepler@unpythonic.net
Wed, 21 Aug 2002 13:31:46 -0500

On Wed, Aug 21, 2002 at 01:15:22PM -0400, David Abrahams wrote:
> I recently added an invocation to help(my_extension_module) to the
> Boost.Python test suite, to prove that I can give reasonable help output.
> Worked great for me, since I was always running the test from within emacs.
> However, some other developer complained that the test required user
> intervention to run, since it would prompt at each screenful. So, I changed
> it to:
>     print pydoc.TextDoc().docmodule(my_extension_module)
> Now I get (well, I'm not sure how this will show up in your mailer, but for
> me it's full of control characters):

In my mailer, X^HX is displayed as a bold X.  It's an old trick of
impact printers and interpreted by fine unix screen pagers such as

I'm not sure how to disable it.  However,
    re.sub("\10.", "", s)
should remove it from "s" without hurting anything else.  I don't know
if pydoc produces underlines.  If underlines
are expressed as X^H_, then it'll convert those to regular text too.
But if underlines are _^HX, you'll want to use
    re.sub(".\10", "", s)
instead.  That'll work for both bold and underline.