[Python-3000] Exceptions internals and removing sys.exc_*

Jim Jewett jimjjewett at gmail.com
Mon Jan 22 16:44:17 CET 2007


On 1/22/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 06:43 PM 1/21/2007 -0800, Brett Cannon wrote:
> >But when something as obvious as moving
> >the traceback to exceptions ... should take the chance to ditch the old way

> How will this affect the __exit__ signature for context managers, which is
> defined in sys.exc_info() terms?  Also, WSGI defines certain
> exception-handling parameters in terms of sys.exc_info().

They can refer to python 2.x, which will still have it.
They can be explicit, and mention a 3-tuple of exception (type, value,
traceback).

They should grow an alternate interface that just takes an exception instance.

> Will we also be dropping three-argument "raise"?

Is there any reason not to drop it?

Even in py2.x, the only reasons I see not to use the single-argument form

    >>> raise Exception("args")

are that (1)  you want to support string exceptions, or (2)  you want
to change the traceback, which could now be done with the traceback
(context/cause) attributes.

-jJ


More information about the Python-3000 mailing list