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

Jim Jewett jimjjewett at gmail.com
Mon Sep 17 21:33:20 CEST 2012

On 9/17/12, Guido van Rossum <guido at python.org> wrote:

> I don't think I've
> ever had a use case in my own code where I found it particularly
> awkward that I couldn't jump from one except clause to the next;

I have had cases where I wanted to either
(1)  Say "oops, not really a match, keep looking at the other except clauses"

The except ... if answers this, but I do think virtual subclasses
would be a better solution.  In my case, I would have created a
subclass for file errors that could be fixed automatically.

(2)  If there is an exception [of such and such a type] do X, but
sometimes *also* do Y.

The continue could answer this, but I'm not convinced it would smell
any less than the current workarounds.


More information about the Python-ideas mailing list