[Python-Dev] Small suggestion re help(Exception)
Nick Coghlan
ncoghlan at gmail.com
Thu Apr 22 00:18:50 CEST 2010
More information about the Python-Dev mailing list
Thu Apr 22 00:18:50 CEST 2010
- Previous message: [Python-Dev] Small suggestion re help(Exception)
- Next message: [Python-Dev] Reject bytearray filename in Python 3.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 ---------------------------------------------------------------
- Previous message: [Python-Dev] Small suggestion re help(Exception)
- Next message: [Python-Dev] Reject bytearray filename in Python 3.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list