[Python-Dev] Proposing a sys.special_exceptions tuple

Nick Coghlan ncoghlan at email.com
Fri Oct 1 03:31:30 CEST 2004

Quoting Barry Warsaw <barry at python.org>:

> > At 08:21 PM 9/30/04 +1000, Nick Coghlan wrote:
> > >However, another possibility occurred to me:
> > >
> > >try:
> > >   # Do stuff
> > >except sys.special_exceptions:
> > >   raise
> > >except:
> > >   # Deal with all the mundane stuff
> +0, except that I'd rather see it put in the exceptions module and given
> a name in builtins.

Hmm, I forgot about the existence of the exceptions module. I agree that makes a
more sensible location than sys.

As for it being a builtin, I have no objections to that. I'll come up with two
patches, though. One to create the tuple in exceptions, and one to give it a
name in builtins (since the latter would presumably be more controversial, like
any new builtin).

My current list of exceptions for inclusion is KeyboardInterrupt, MemoryError,
SystemExit & StopIteration.

The inclusion of StopIteration is what makes me prefer 'special_exceptions' as
the name of the tuple, rather than 'critical_exceptions'.


Nick Coghlan
Brisbane, Australia

More information about the Python-Dev mailing list