Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Greg Ewing
Guido van Rossum wrote: > Perhaps we could allow reraising whenever the > existing traceback chain contains a reference to a frame that is an > ancestor of (or equal to) the newly raising frame? This is starting to sound terribly hairy. Would it help if a different syntax were used for raising an

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Greg Ewing
Guido van Rossum wrote: > But what's the advantage of not instantiating the exception if we > instantiate the context instead? Probably not much. But most control-flow-exception catching will just be 'except E:' in which case you don't need to instantiate anything. (Assuming we get rid of traceba

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Guido van Rossum
On 3/2/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > I'm afraid we're back at square zero; perhaps we should keep the > > existing (type, value, traceback) API > > Whatever happens, we should be able to get that down > to at most two things: (exception, context) where >

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Guido van Rossum
On 3/2/07, Andrew Dalke <[EMAIL PROTECTED]> wrote: > On 3/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > 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 tha

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Greg Ewing
Guido van Rossum wrote: > I'm afraid we're back at square zero; perhaps we should keep the > existing (type, value, traceback) API Whatever happens, we should be able to get that down to at most two things: (exception, context) where exception is either a class or an instance, and context include

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Andrew Dalke
On 3/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > 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 multipl

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Guido van Rossum
On 3/2/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 2/26/07, Andrew Dalke <[EMAIL PROTECTED]> wrote: > > My concern when I saw Guido's keynote was the worry that > > people do/might write code like this > > > > NO_END_OF_RECORD = ParserError("Cannot find end of record") > > > > def parse_recor

Re: [Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Greg Ewing
Collin Winter wrote: > Do those who oppose __traceback__ also oppose __cause__ and > __context__? They would seem to have the same problems. Whatever solution is adopted for the traceback should probably be applied to them as well, perhaps by generalising the traceback into an "exception context"

[Python-Dev] PEP 344 (was: with_traceback)

2007-03-02 Thread Collin Winter
On 2/26/07, Andrew Dalke <[EMAIL PROTECTED]> wrote: > My concern when I saw Guido's keynote was the worry that > people do/might write code like this > > NO_END_OF_RECORD = ParserError("Cannot find end of record") > > def parse_record(input_file): >... > raise NO_END_OF_RECORD >... > >