On 5/11/05, Steven Bethard <[EMAIL PROTECTED]> wrote:
> If you want the default to be that the exception gets re-raised
> (instead of being suppressed as it is above), I think you could just
> change the finally block to something like:
>
> finally:
> if stmt_exit(*exc):
> raise exc[0], exc[1], exc[2]
>
> That would mean that if any nonzero object was returned from __exit__,
> the exception would be reraised.
Oops. This should have been:
finally:
if not stmt_exit(*exc):
raise exc[0], exc[1], exc[2]
This would mean that if a function returned None (or any other "False"
object) the exception would be reraised. Suppressing the reraising of
the exception would require returning a nonzero object.
STeVe
--
You can wordify anything if you just verb it.
--- Bucky Katt, Get Fuzzy
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com