[Python-Dev] RE: PEP-317
Michael Chermside
mcherm@mcherm.com
Tue, 10 Jun 2003 06:52:10 -0700
Greg Ewing:
> Also while we're at it, how about storing the traceback in the
> exception object, and getting rid of sys.exc_info() etc.?
Guido:
> That's a good idea, and I'd support a PEP on that topic more than PEP
> 317 (which IMO is unnecessary).
IMO the biggest advantage of PEP 317 is not what it does directly but the
future enhancements it allows. If all exceptions really are objects,
(particularly if strengthened to say "instances of Exception or subclasses")
then we can add new features to Exception. Moving the traceback into
the object is one idea. Making Exception a new-style object is another
(no need to rush, but it'll happen SOMEDAY, right?). Exception
chaining (aka exception masking) is another.
The point is, without PEP 317, you can't do these things, because sometimes
you use an object, and sometimes just mention a class (and sometimes just
use a string). PEP 317 choose not to try to bite off anything bigger than
fixing this so future enhancements would be possible. But we EVER want
these kinds of enhancements, then start a PEP 317 style migration NOW,
because degree of code breakage means that the migration time will be really
slow. Deprecating (ideally with warnings) sooner is better.
-- Michael Chermside