No need to guess what help does; just read the source.
The built-in help is created on site.py, this is an instance of the _Helper class. When called, it simply passes the call through pydoc.help(...) source for which you will find in pydoc.py.
class _Helper(object): """Define the built-in 'help'. This is a wrapper around pydoc.help (with a twist). """ def __repr__(self): return "Type help() for interactive help, " \ "or help(object) for help about object." def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
pydoc.help is an instance of pydoc.Helper with I / O installed on sys.stdin , sys.stdout , but (and I suspect that this is exactly where you have the problem) it uses the value stdin / stdout for a while, when pydoc is imported, so re-linking them later will have no effect.
I suggest you replace the built-in help instance with your own _Helper class, which creates a new pydoc helper explicitly with any files you need.
source share