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

Fredrik Lundh fredrik at pythonware.com
Mon Sep 6 09:44:12 CEST 2004


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?

Python 2.4a3 (#1, Sep  3 2004, 11:32:03)
>>> StandardException
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'StandardException' is not defined
>>> StandardError
<class exceptions.StandardError at 0x401a329c>
>>> issubclass(MemoryError, StandardError)
True
>>> issubclass(KeyboardInterrupt, StandardError)
True
>>> issubclass(SystemExit, StandardError)
False
>>> issubclass(StopIteration, StandardError)
False
>>> issubclass(ImportError, StandardError)
True

</F> 





More information about the Python-Dev mailing list