On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote:
>
>
> On 1/22/07, Mark Hammond <[EMAIL PROTECTED]> wrote:
> > > Guido has mentioned [1] that since exceptions will be growing a
> > > __traceback__ attribute in Python 3, it should be possible to remove
> > > sys.exc_info().
> >
> > sys.exc_info() is also useful for returning the exception itself, not only
> > the traceback. The traceback and logger modules both take advantage of it
> > to avoid the pain of passing exception objects around. eg:
> >
> > try:
> > ...
> > except Foo:
> > logger.exception("something bad happened")
> >
> > is better than what may otherwise be necessary:
> >
> > except Foo, f:
> > logger.exception("something bad happened", exc_info=f)
> >
> > It seems a reasonable use case to have code that knows it is dealing with
> > exceptions, but not always be directly in the exception handler.
>
> I agree, and believe sys.exc_info() should just stay. There's also the case
> of try/finally and fetching any raised exception there. (In fact, doesn't
> the 'with' statement do something similar?)
>
We can at least discourage its use while leaving it in, with the
possibility of removing it in the future once people are used to
tracebacks being on exceptions. How long that will be who knows
(maybe Py4K =).
-Brett
_______________________________________________
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