Sarir Khamsi wrote: > Is there a way to get help the way you get it from the Python > interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the > module cmd.Cmd? I know how to add commands and help text to cmd.Cmd > but I would also like to get the man-page-like help for classes and > functions. Does anyone know how to do that? Thanks.
>>> dir(help) ['__call__', '__class__', '__delattr__', '__dict__', ... [Hmm... unexpected result... let's see what it is.] >>> help.__class__ <class 'site._Helper'> [ah... loading site.py and looking for "_Helper"...] 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) HTH :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list