[Python-Dev] Re: Dangerous exceptions (was Re: Another test_compilermystery)

Barry Warsaw barry at python.org
Tue Sep 7 18:01:08 CEST 2004

On Tue, 2004-09-07 at 11:11, Kevin Jacobs wrote:

> My policy for bare excepts is that without significant justification
> they _must_ either re-raise the original exception or raise another
> exception.  There are very few circumstances where I have allowed
> my team to write pure bare excepts.  I haven't checked, but a warning
> for violations of this rule may be a nice addition to pychecker or pylint.

The other case I've seen are for command-shell like loops, where you
might print the exception in the bare except, but not re-raise the
exception.  Think about the main interactive interpreter loop.

But yeah I agree, you want strong justification for any use of bare


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20040907/0ad56503/attachment.pgp

More information about the Python-Dev mailing list