Magic Optimisation

Terry Reedy tjreedy at
Thu Sep 15 00:52:19 CEST 2005

"Paul McGuire" <ptmcg at> wrote in message 
news:1126708466.322632.78990 at
> Terry -
> If setting up a try-block is as fast (or "takes as long") as one
> iteration loop, then wont putting a try-block inside a loop double the
> execution time?

It will double (more or less) the loop overhead.  The effect of that 
depends on the overhead/payload ratio.  And, I was responding to the idea 
that adding a loop to avoid most try statements would be significantly 

Terry J. Reedy

More information about the Python-list mailing list