A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-April/099620.html below:

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

[Python-Dev] Small suggestion re help(Exception)Nick Coghlan ncoghlan at gmail.com
Thu Apr 22 00:18: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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4