[Python-Dev] pydoc.py (show docs both inside and outside of Python)

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu, 11 Jan 2001 22:20:45 +0100


> I would very much appreciate your feedback

At the first glance, it looks *very* promising. I really look forward
to see it in 2.1.

However, robustness probably needs to be improved:

>>> help()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: not enough arguments to help(); expected 1, got 0    

Wasn't there even a proposal that

>>> help

should do something meaningful (by implementing __repr__)?

>>> import string
>>> help(string)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "pydoc.py", line 183, in help
    pager('Help on %s:\n\n' % desc + textdoc.document(thing))
  File "./textdoc.py", line 171, in document
    if inspect.ismodule(object): results = document_module(object)
  File "./textdoc.py", line 87, in document_module
    if (inspect.getmodule(value) or object) is object:
  File "./inspect.py", line 190, in getmodule
    file = getsourcefile(object)
  File "./inspect.py", line 204, in getsourcefile
    filename = getfile(object)
  File "./inspect.py", line 172, in getfile
    raise TypeError, 'arg is a built-in class'
TypeError: arg is a built-in class

Also, the tools could use some command line options:

martin@mira:~/pydoc > ./pydoc.py --help
Traceback (most recent call last):
  File "./pydoc.py", line 190, in ?
    opts[args[i][1:]] = args[i+1]
IndexError: list index out of range

At a minimum, I propose -h, --help, -v, -V.

Regards,
Martin