[Python-Dev] PEP 348 (exception reorg) revised again

Raymond Hettinger raymond.hettinger at verizon.net
Mon Aug 15 15:16:47 CEST 2005

> This obviously goes against what Guido last said he
> wanted, but I hope I can convince him to get rid of bare 'except's.

-1 on eliminating bare excepts.  This unnecessarily breaks tons of code
without offering ANY compensating benefits.  There are valid use cases
for this construct.  It is completely Pythonic to have bare keywords
apply a useful default as an aid to readability and ease of coding.

+1 on the new BaseException

+1 on moving NotImplementedError, SystemExit, and KeyboardInterrupt.

-1 on replacing "except (KeyboardInterrupt, SystemExit)" with "except
TerminatingException".  1) Grepping existing code bases shows that these
two are almost never caught together so it is a bit silly to introduce a
second way to do it.  2) Efforts to keep the builtin namespace compact
argue against adding a new builtin that will almost never be used.  3)
The change unnecessarily sacrifices flatness, making the language more
difficult to learn.  4) The "self-documenting" rationale is weak -- if
needed, a two-word comment would suffice.  Existing code almost never
has had to comment on catching multiple exceptions -- the exception
tuple itself has been sufficiently obvious and explicit.  This rationale
assumes that code readers aren't smart enough to infer that SystemExit
has something to do with termination.


More information about the Python-Dev mailing list