[issue8525] Small enhancement to help()

Alexander Belopolsky report at bugs.python.org
Mon Nov 22 02:33:42 CET 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

The following passes tests in elp_8525.patch, but is much simpler:

===================================================================
--- Lib/pydoc.py	(revision 86600)
+++ Lib/pydoc.py	(working copy)
@@ -1139,6 +1139,15 @@
                 push('    ' + makename(base))
             push('')
 
+        # List the built-in subclasses, if any:
+        subclasses = [cls.__name__ for cls in object.__subclasses__()
+                      if cls.__module__ == 'builtins']
+        if subclasses:
+            push("Built-in subclasses:")
+            for subclassname in sorted(subclasses):
+                push('    ' + subclassname)
+            push('')
+
         # Cute little class to pump out a horizontal rule between sections.
         class HorizontalRule:
             def __init__(self):

----------
nosy: +belopolsky

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8525>
_______________________________________


More information about the Python-bugs-list mailing list