[Python-Dev] Bare except clauses in PEP 348

James Y Knight foom at fuhm.net
Wed Aug 24 16:34:53 CEST 2005


On Aug 23, 2005, at 10:41 PM, Raymond Hettinger wrote:

> [Guido van Rossum]
>
>> If we syntactically enforce that the bare except, if present, must be
>> last, would that remove your objection? I agree that a bare except in
>> the middle is an anomaly, but that doesn't mean we can't keep bare
>> except: as a shorthand for except Exception:.
>>
>
> Hmm.  Prohibiting mid-suite bare excepts is progress and eliminates  
> the
> case that causes immediate indigestion.
>
> As for the rest, I'm not as sure and it would be helpful to get  
> thoughts
> from others on this one.  My sense is that blocking the clause from
> appearing in the middle is treating the symptom and not the disease.
>

I would rather see "except:" be deprecated eventually, and force the  
user to say either except Exception, except BaseException, or even  
better, except ActualExceptionIWantToCatch.

James


More information about the Python-Dev mailing list