[Python-3000] Pre-peps on raise and except changes

Collin Winter collinw at gmail.com
Sat Feb 10 02:08:28 CET 2007

On 2/9/07, Guido van Rossum <guido at python.org> wrote:
> On 2/9/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > Collin Winter wrote:
> >
> > > I believe the original proposal was something like
> > >
> > > raise E(V).with_traceback(T)
> >
> > Does this mean you're not intending to have any syntactic
> > variant of the raise statement that includes a traceback
> > in 3.0? Or is this just so that forward-compatible code
> > can be written in 2.6?
> >
> > If you wanted a distinctive syntax, it could be something
> > like
> >
> >    raise e with t
> I can see uses for endowing an exception object with a traceback
> without raising it (yet), so we'd still need the method; since we have
> the method I'm not sure that we need syntax; I don't expect this to be
> needed a lot. (Isn't there also a proposal for automatic exception
> chaining? That might mean we'll need this even less.)

The current 3-argument form of "raise" is used incredibly rarely
(compared to other raise forms), so I don't see a need for this kind
of syntactic support. Also, adding a "with" clause like that means we
have to hash out whether it goes in front of "from" (in "raise ...
from ...") or after it, etc, etc, and that's just begging for
100+-post bikeshedding threads.

Collin Winter

More information about the Python-3000 mailing list