[issue8525] Small enhancement to help()
report at bugs.python.org
Sun Apr 25 01:10:05 CEST 2010
New submission from Rob Cliffe <rob.cliffe at btinternet.com>:
help() on an exception class lists the method resolution order, which is in effect the class inheritance hierarchy. E.g. help(ArithmeticError) lists ArithmeticError, StandardError, Exception, BaseException, __builtin__.object. It struck me it would help to find my way around if it also listed the builtin SUBclasses (if any). Something like:
In fact why not do it for any class, not just exceptions?
I attach a patched version of pydoc.py - tested but only on my PC which is running Python 2.5 under Windows XP. I have added lines 1129-1148 to the docclass method of the TextDoc class (and flagged them # [RAC] ).
(I don't pretend to understand the magic where __builtins__ is a dictionary when pydoc.py is run but becomes a module later on. Never mind - the patch works (I believe).)
For consistency, a similar patch would also have to be made to the docclass nethod of the HTMLDoc class (which outputs HTML rather than plain text). I have not attempted this as I don't know how it is called and hence how to test any patch, but it should be straightforward for anyone with the know-how.
title: Small enhancement to help()
type: feature request
versions: Python 2.5
Added file: http://bugs.python.org/file17075/pydoc.py
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list