[Python-3000] simplifying the exception mechanism
Brett Cannon
brett at python.org
Mon Jan 22 23:56:19 CET 2007
On 1/22/07, Collin Winter <collinw at gmail.com> wrote:
> On 1/22/07, tomer filiba <tomerfiliba at gmail.com> wrote:
> > with all the talk about enhancing exceptions and removing unnecessary
> > functions from the codebase, i think we can also drop
> > PyErr_NormalizeException and friends.
>
> One argument in favor of keeping PyErr_NormalizeException() (as I've
> learned from trying to rip it out) is the speed advantage it brings.
> It's less expensive to sock away the exception class and arguments,
> only instancing the exception when you really need it. This is
> important in certain core types, where light(er)-weight exception
> raising comes in handy.
>
I'm with Collin on this one. The speed argument is one of the reasons
PyErr_NormalizeException even exists. We want exceptions in the
simple, general case to be as fast as possible.
-Brett
More information about the Python-3000
mailing list