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/2001-November/018426.html below:

[Python-Dev] Proposal - KeyboardInterrupt should inherit directly from Exception

[Python-Dev] Proposal - KeyboardInterrupt should inherit directly from Exception [Python-Dev] Proposal - KeyboardInterrupt should inherit directly from ExceptionSkip Montanaro skip@pobox.com (Skip Montanaro)
Thu, 8 Nov 2001 12:43:13 +0100
    SM> I suggest that KeyboardInterrupt should also inherit from
    SM> Exception, and not StandardError.

    BAW> It doesn't sound completely unreasonable, but I'd be -1 on it for
    BAW> Python 2.2.

Yeah, that's why I didn't ask "I know we're in feature freeze, but can we
please please please make this one itty bitty change? Please please please?
Did I forget to mention please please please?"  ;-)

    BAW> I do stuff like this all the time, although it's usually OSError.
    BAW> I love that OSError and IOError have a common base class!  I've
    BAW> often wanted all the errno's to be transformed into subclasses of
    BAW> IOError/OSError, so I could just do something like:

    BAW>     try:
    BAW>        os.mkdir(...)
    BAW>     except OSErrorEEXIST:
    BAW>        pass
    BAW>     # any other OSError propagates up

Why not make them all subclasses of OSError that are also attributes of the
OSError class.  You'd then have

    try:
       os.mkdir(...)
    except OSError.EEXIST:
       pass
    # any other OSError propagates up

which seems a little less builtin namespace polluting to me.  After all,
there are quite a few signals, yes?

Skip



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