Magic Optimisation

simonwittber at simonwittber at
Tue Sep 6 05:37:02 CEST 2005

Paul McGuire wrote:
> I still think there are savings to be had by looping inside the
> try-except block, which avoids many setup/teardown exception handling
> steps.  This is not so pretty in another way (repeated while on
> check()), but I would be interested in your timings w.r.t. your current
> code.

Your suggested optimisation worked nicely. It shaved 0.02 seconds from
a loop over 10000 iterators, and about 0.002 seconds from a loop over
1000 iterators.

More information about the Python-list mailing list