[Python-Dev] Re: Dangerous exceptions (was Re: Another test_compilermystery) (original) (raw)

Jeremy Hylton jhylton at gmail.com
Tue Sep 7 14:09:49 CEST 2004


On Mon, 6 Sep 2004 09:44:12 +0200, Fredrik Lundh <fredrik at pythonware.com> wrote:

Jeremy Hylton wrote:

> The current exception hierarchy isn't too far from what you suggest. > We just got the names wrong. That is, there is a base class, > StandardException, that captures most exceptions other than > MemoryError, SystemError, and KeyboardInterrupt. If we renamed that > Exception, then we'd be 90% of the way there. You could also change > your code, right now, to say "except StandardError:" and avoid the > problem entirely. when was that changed?

I misread the very long output of pydoc exceptions :-). I don't understand the hierarchy, either, or I would have noticed that the results don't make sense. Why isn't StopIteration a StandardError?

I'll second Tim's suggestion that some errors -- like SystemError, MemoryError, and KeyboardInterrupt belong in a different category. I think it would be easier in principle to put them at a different place in the class hierarchy than to make them some special kind of uncatchable exception.

Jeremy



More information about the Python-Dev mailing list