[Python-Dev] Exception hierarchy [was Re: Another test_compilermystery]

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Aug 17 03:11:17 CEST 2004


James Y Knight wrote:

> One issue is that creating a new category of Exceptions doesn't help
> people who do "except:" instead of "except Exception:". It is unlikely
> that person meant to catch things like MemoryError, rather, they were
> just being lazy. I suppose that syntax could be deprecated, at least
> in 
> example code and documentation, in favor of "except Exception" for the
> usual case, and "except Raisable" for the cases where you do actually
> want to catch everything*.

Personally, I would be in favour of a bare except being equivalent in
new code to 'except Exception'. Although this does violate 'in the
presence of ambiguity, resist the temptation to guess'.

Tim Delaney


More information about the Python-Dev mailing list