Roger Miller wrote:
> On Jan 24, 11:30 am, Jonathan Gardner <[EMAIL PROTECTED]>
> wrote:
>> ....
> 
>> A few sample good uses of try/except blocks:
>> (1) Do something else if an expected exception occurs.
>> (2) Show a friendly error message when an exception occurs over ...
> I'd add (3) Clean-up handlers.  These don't actually handle the
> problem, they just free resources, close files, etc. before re-
> raising the exception for someone else to worry about.

Ah, but typically these are try/finally blocks.  Many can be dealt
with by context mangers in 2.5 or later -- see with_statement.


--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to