On Mon, Apr 14, 2008 at 6:59 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: > 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. No, that's some kind of parsing error. EnvironmentError doesn't concern itself with the contents of files. > 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. But what operations raise EOFError? Surely you're not using raw_input()? It's really only there for teaching. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4