On 2/9/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 2/9/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > At 01:33 PM 2/10/2007 +1300, Greg Ewing 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? > > > > That *is* the variant. ;) > > > > > > >Or is this just so that forward-compatible code > > >can be written in 2.6? > > > > Actually, forward compatible code would be easier with something syntactic, > > like your 'raise e with t' idea. It would allow the implementation to be > > different in 2.6 and 3.0, while using the same syntax. (In 2.6 it could > > use the existing machinery, while in 3.0 it could call the > > .with_traceback() method. > > > > Hm. Actually, that's not necessary. We could include .with_traceback(T) > > in 2.6, and just have old-style except: clauses delete the traceback from > > the returned objects. New-style except: clauses would work just as they > > would in 3.0. > > > > To summarize, in 2.6 we could support .with_traceback() and create > > exception instances with traceback attributes, but the old-style except: > > clauses could discard them to prevent cycles. Raising an exception > > instance with a __traceback__ attribute would get some special handling so > > that it's equivalent to 3-argument raise in today's Python. Likewise, > > generator.throw() would need the same special handling in 2.6. Meanwhile, > > sys.exc_info() still lives in both versions. > > > > To write 3.0-compatible code, you just use the 3.0 spellings of raise, > > throw(), and except. Sounds like a plan! > > Can't see anything wrong with this either. Collin, do you have enough > to update your PEPs?
I think so. I've already got language ready for the section on using BaseException.with_traceback() in the 2->3 raise translations, and I'll work up additional language for the transition plan sometime this weekend. > I wonder if we should try to keep PEP 344 up to date, or if we should > just do this in the Py3k PEPs; I'm okay with adding some notes about > 2.6 to Py3k PEPs so I guess the latter would work. If with_traceback() is going to be added in 2.6, I think at least that much should go in PEP 344. The rest falls under "transitioning to 3.0", so it should probably go in PEP 3109. Collin Winter _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
