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

Nick Coghlan ncoghlan at gmail.com
Thu Apr 22 00🔞50 CEST 2010


Rob Cliffe wrote:

Yes, exactly like that. I wasn't aware of subclasses (it doesn't appear in dir(ArithmeticError), for example)

Slight tangent: dir() usually includes class attributes (e.g. "set(dir(1)) >= set(dir(int))"), but to prevent weirdness that particular feature is omitted for the metaclass of a type. So dir(type(cls)) may reveal a few extra methods/properties (such as mro() and subclasses()) that aren't listed when doing dir(cls).

but if my suggestion were adopted, subclasses would be just what is needed to implement it.

Restricting it to just builtins would be tricky, especially for Exception (even without importing any additional libraries, Exception.subclasses() lists 23 direct subclasses at the interpreter prompt for me).

Anyway, as Michael suggested, a feature request on the bugs.python.org tracker is the best way forward. That's no guarantee that anyone will pick it up and run with it, but at least it will record the idea.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list