[Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)

Guido van Rossum guido at python.org
Fri Feb 9 23:57:13 CET 2007


On 2/9/07, Collin Winter <collinw at gmail.com> wrote:
> > On 2/9/07, Georg Brandl <g.brandl at gmx.net> wrote:
> > > One question: will there be an exception keyword argument to set the
> > > traceback, to simplify
> > >
> > > e = Error(V)
> > > e.__traceback__ = tb
> > > raise e
> > >
> > > to
> > >
> > > raise Error(V, traceback=tb)
> > >
> > > I remember this being proposed, but could not find it in the PEPs.
>
> I believe the original proposal was something like
>
> raise E(V).with_traceback(T)
>
> My preference would be a method (as opposed to a keyword argument).

Fair enough; that way the signature of user-provided exceptions
doesn't need to be messed with.

> On 2/9/07, Guido van Rossum <guido at python.org> wrote:
> > I agree that this API is better. If it's not in PEP 344 it should be added.
>
> Should this be added to PEP 344 or 3109? That is, do you want to see
> it before Python 3?

I think storing the traceback in the exception is a 3.0 feature, since
it depends on the effective 'del e' at the end of the except clause
for avoiding most cycles.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list