Interpreter-like help in cmd.Cmd
peter at engcorp.com
Thu Jun 9 23:19:54 CEST 2005
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.
['__call__', '__class__', '__delattr__', '__dict__', ...
[Hmm... unexpected result... let's see what it is.]
[ah... loading site.py and looking for "_Helper"...]
"""Define the built-in 'help'.
This is a wrapper around pydoc.help (with a twist).
return "Type help() for interactive help, " \
"or help(object) for help about object."
def __call__(self, *args, **kwds):
return pydoc.help(*args, **kwds)
More information about the Python-list