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

Steven steve at pearwood.info
Sat Apr 19 04:12:55 CEST 2008

On Sat, 19 Apr 2008 12:18:47 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Antoine Pitrou wrote:
> > Why do you want to derive program bugs from EnvironmentError ? Usually I derive
> > them from ValueError, RuntimeError or simply Exception.
> I'm *not* talking about program bugs, I'm talking about
> exceptions due to something the user did wrong.
> I like to be able to do this:
>    try:
>      f = open(somefile)
>      mungulate(f)
>      f.close()
>    except EnvironmentError, e:
>      big_nasty_alert("Couldn't mungulate: %s" % e)

It might help if you explain what sort of actual things that the user does 
wrong that you are talking about. From where I'm sitting, the only thing I 
can see that the user could do wrong is specify the wrong file. That doesn't
sound like an EnvironmentError to me, but I don't know that it should be a 
ValueError or TypeError either.

Steven <steve at pearwood.info>

More information about the Python-Dev mailing list