[Python-Dev] PEP 344

Michael Foord fuzzyman at voidspace.org.uk
Sat Mar 3 01:32:56 CET 2007


Guido van Rossum wrote:
> [snip..]
> The one thing that makes me not want to give up yet is that having the
> traceback, context, cause etc. as attributes of the exception object
> would seem to make the API for handling exceptions that much cleaner,
> compared to having to call sys.exc_info() or even "except E as v with
> tb".
>
> So, despite the existence of libraries that pre-create exceptions, how
> bad would it really be if we declared that use unsafe? It wouldn't be
> hard to add some kind of boobytrap that goes off when pre-created
> exceptions are raised multiple times. If this had always been the
> semantics I'm sure nobody would have complained and I doubt that it
> would have been a common pitfall either (since if it doesn't work,
> there's no bad code abusing it, and so there are no bad examples that
> newbies could unwittingly emulate).
>
>   
Personally, I think the new attributes and the new syntax are *great* 
improvements to exception handling. I would be sad to see parts of these 
proposals not happen.

Michael Foord


More information about the Python-Dev mailing list