[Python-ideas] [Python-Dev] OSError.errno => exception hierarchy?

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 3 05:17:37 CEST 2009


Guido van Rossum wrote:
> Consider
> an errno (EWIN, mapped to OSWinError in your proposal) that exists
> only on Windows, and another (ELIN, OSLinError) that exists only on
> Linux.

Also, some platforms may have a rather large number
of possible error codes. Not sure what MacOSX is like,
but Classic MacOS had literally *hundreds* of OSError
values. Having a class for each one would be rather
unwieldy.

What might make more sense is to have a way of
attaching a guard expression to an except clause,
maybe

   except OSError as e if e.errno = ESPAM:
     ...

-- 
Greg



More information about the Python-ideas mailing list