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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Apr 15 03:59:36 CEST 2008

Guido van Rossum wrote:
> I don't think of EOFError as an environmental error... This is quite
 > a different level of error than what EnvironmentError typically means

I think it depends. Any "expected" EOFErrors are going to be
caught by the surrounding code before propagating very far.
An *uncaught* EOFError probably means that a file was shorter
than you expected it to be, which counts as an environmental
error to my way of thinking.

My current coding style involves wrapping an "except EnvironmentError"
around any major operation and reporting it as a "File could not be
read/written/whatever because..." kind of message. Having
EOFError get missed by that would be a nuisance.


More information about the Python-Dev mailing list