Interpreter-like help in cmd.Cmd

Peter Hansen peter at engcorp.com
Thu Jun 9 21:56:37 EDT 2005


Sarir Khamsi wrote:
> Peter Hansen <peter at engcorp.com> writes:
> 
>>class _Helper(object):
...
>>     def __call__(self, *args, **kwds):
>>         import pydoc
>>         return pydoc.help(*args, **kwds)
> 
> Thanks, but how do I integrate this with cmd.Cmd?

I can't say exactly.  That might depend on what you are doing with it, 
and how you are currently handling other things with it.  All I know is 
that the builtin "help" just passes its arguments to pydoc.help() and 
that seems to do the job.

I'd suggest you work from there and experiment with your current cmd.Cmd 
mechanisms to see what you can get working, then post a snippet or to 
back here for further assistance.  Almost working code is almost always 
better than starting with nothing.  (I would help if I remembered 
anything about cmd.Cmd, really, but it's been years.)

-Peter



More information about the Python-list mailing list