A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-January/051102.html below:

[Python-Dev] Exceptions *must*? be old-style classes?

[Python-Dev] Exceptions *must*? be old-style classes? [Python-Dev] Exceptions *must*? be old-style classes?Phillip J. Eby pje at telecommunity.com
Sun Jan 16 03:22:28 CET 2005
At 05:57 PM 1/15/05 -0800, Guido van Rossum wrote:
>It's been suggested that all exceptions should inherit from Exception,
>but this would break tons of existing code, so we shouldn't enforce
>that until 3.0. (Is there a PEP for this? I think there should be.)

Couldn't we require new-style exceptions to inherit from Exception?  Since 
there are no new-style exceptions that work now, this can't break existing 
code.  Then, the code path is just something like:

     if isinstance(ob,Exception):
         # it's an exception, use its type

     else:
         # all the other tests done now

This way, the other tests that would be ambiguous wrt new-style classes can 
be skipped, but non-Exception classic classes would still be handled by the 
existing checks.

Or am I missing something?

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