Rob Cliffe <rob.cli...@btinternet.com> added the comment:

I would not be at all surprised if my patch could be simplified (in fact 
I'd be surprised if it couldn't).
However, I did try out your version on Python 2.5 specifically, and it 
did not work for me.
Trying it out on help(Exception), the relevant members of 
object.__subclasses__() viz.
<type 'exceptions.StandardError'>, <type 'exceptions.StopIteration'>  etc.
had a __module__attribute which equalled 'exceptions', not 'builtins'.
Best wishes
Rob Cliffe

On 22/11/2010 01:33, Alexander Belopolsky wrote:
> Alexander Belopolsky<belopol...@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<rep...@bugs.python.org>
> <http://bugs.python.org/issue8525>
> _______________________________________
>

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to