[Python-ideas] syntax to continue into the next subsequent except block

Stephen J. Turnbull stephen at xemacs.org
Thu Sep 20 11:17:34 CEST 2012

Chris Kaynor writes:

 > On Mon, Sep 17, 2012 at 11:55 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
 > > On Tue, Sep 18, 2012 at 11:08 AM, Stephen J. Turnbull
 > > <stephen at xemacs.org> wrote:
 > >> I agree with the suggestion that really we should fix up other
 > >> Exceptions that are clearly quite heterogeneous by subclassing
 > >> more precise exceptions from them.  But this isn't always
 > >> possible, and of course may not be backward compatible.
 > If done well, it should be fully backwards compatible. There is not
 > reason that you cannot keep the errno (or however its named on the
 > specific exception class) while still subclassing the exception.

Of course that's backward compatible with old code receiving the new
subclassed exceptions.  Maybe I misused the term "backward
compatible", but what I meant was that it's likely to be the case that
the person doing the subclassing will unify groups of error codes he
believes unlikely to need distinguishing in Python applications
(vs. more low-level languages).  Eg, I don't see more than one hundred
new Exceptions in PEP 3151, but only a handful (about 15).

More information about the Python-ideas mailing list