[Python-Dev] thoughts on having EOFError inherit from EnvironmentError?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 16 00:27:13 CEST 2008

Guido van Rossum wrote:

> No, that's some kind of parsing error. EnvironmentError doesn't
> concern itself with the contents of files.

Often I raise EnvironmentErrors of my own to signal
parsing errors. This makes it easy to wrap everything
in a try-except that catches anything that's the user's
fault rather than the program's.

> But what operations raise EOFError? Surely you're not using
> raw_input()? It's really only there for teaching.

I'm fairly sure there are some others, although I
can't point to them on the spur of the moment.

However, thinking about it a bit more, anything that
calls something that can raise EOFError should be
catching it anyway, so an escaped EOFError represents
a program bug. So it's probably okay.


More information about the Python-Dev mailing list