[Python-Dev] Merging PEP 310 and PEP 340-redux?
Steven Bethard
steven.bethard at gmail.com
Wed May 11 23:47:58 CEST 2005
On 5/11/05, Steven Bethard <steven.bethard at gmail.com> 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
More information about the Python-Dev
mailing list