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

Nick Coghlan ncoghlan at gmail.com
Mon Sep 17 14:13:56 CEST 2012


On Mon, Sep 17, 2012 at 8:51 PM, Paul Wiseman <poalman at gmail.com> wrote:
> I conceded that my idea of jumping from one except clause to the next was a
> bad one, but with the except..if idea there would be no jumping; it would
> work the same as it currently does where an exception can only enter at most
> one except block in the same level of try..excepts.

The key thing to remember is that the bar for new syntax is *very high*.

The reason it was kicked around as a possibility in the PEP 3151
discussions is that checking errno values is really common and (more
importantly) often not done correctly (leading to overbroad trapping
of errors).

PEP 3151 ultimately chose to solve the problem a different way (i.e.
modifying the standard exception hierarchy) that didn't require new
syntax. In so doing, it also gutted the case for this being a common
problem. It *used to be* a common problem, but most cases of errno
checking are now better handled by catching more specific OSError
subclasses.

It's simply not worth increasing the complexity of the except clause
definition to deal with the new rare cases that are already amenable
to other solutions, in particular just catching the superclass and
then interrogating for additional details.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list