else: w/o except: - why not?

David Eppstein eppstein at ics.uci.edu
Tue Apr 1 11:50:42 EST 2003


In article <mailman.1049211247.3694.python-list at python.org>,
 Michael Chermside <mcherm at mcherm.com> wrote:

> I think that a "bare except" is useful in only two ways. The first
> is like a "finally" clause that's skipped if everything works.
[...snip...]
> The other situation is running "untrusted plug-in" code of some 
> sort.

I have a bare except wrapped around the main event loop of some python 
gui code.  It provides an opportunity to log the problem and give the 
user a chance to clean up instead of just immediately crashing.
Doesn't seem to fit into either of your two uses, but I think it's a 
legit use.

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list