[Python-Dev] Small suggestion re help(Exception)

Michael Foord fuzzyman at voidspace.org.uk
Wed Apr 21 18:22:36 CEST 2010


On 21/04/2010 18:17, Rob Cliffe wrote:
> help() on an Exception class lists the method resolution order 
> (effectively the inheritance hierarchy).
> E.g. help(ArithmeticError) displays inter alia:
> Method resolution order:
>     ArithmeticError
>     StandardError
>     Exception
>     BaseException
>     __builtin__.object
> Would it be possible for it also display the Python built-in 
> SUBclasses of the class?  E.g. in the same example something like:
> Built-in subclasses:
>     FloatingPointError
>     OverflowError
>     ZeroDivisionError
> This may seem pointless to grizzled old Python veterans who (maybe) 
> know the inheritance hierarchy backwards, but for those of us with 
> less experience I think it would be helpful, e.g.
> (1) It would help to track down an Exception whose name you have 
> forgotten.
> (2) It would sometimes be illuminating, e.g. LookupError might be a 
> bit obscure at first, until you see that it is the superclass of the 
> familiar IndexError and KeyError.
> Sorry, I'm not sure if I should send this sort of thing to 
> Python-Ideas or Python-Dev, so please let me know gently which one I 
> should (not) have sent it to.

This sounds like a pretty straightforward feature request that you could 
put on the tracker (preferably with patch and tests of course), but is 
on-topic for this mailing list.

I rarely use help(...) myself (I probably should), but it sounds like a 
useful enhancement.

Michael

> Best wishes
> Rob Cliffe
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>    


-- 
http://www.ironpythoninaction.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100421/79ce1f9a/attachment.html>


More information about the Python-Dev mailing list