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

Chris Rebert pyideas at rebertia.com
Sun Sep 16 23:32:12 CEST 2012

On Sun, Sep 16, 2012 at 1:51 PM, Joshua Landau
<joshua.landau.ws at gmail.com> wrote:
> Instead of adding syntax, we could make except use isinstance.
> class SpecificOSErrorType(type):
> def __instancecheck__(cls, othercls):
> if isinstance(othercls, OSError):
> class FileExistsOSError(OSError, metaclass=SpecificOSErrorType):
> Disadvantages:
> - It doesn't work yet [*wink*]

There's actually an already-open bug regarding that:
"Catching virtual subclasses in except clauses"


More information about the Python-ideas mailing list