Magic Optimisation

Terry Reedy tjreedy at
Wed Sep 14 16:16:40 CEST 2005

"ABO" <abo at> wrote in message 
news:1126696724.760484.311670 at
> There are other "optimisations" that could be applied that make this
> code faster but uglier. For example, putting another "while True: loop
> inside the try block to avoid the try block setup each iteration.

In CPython, 'setting up' try-blocks is (intentionally) very fast, perhaps 
as fast or faster than one interation loop.


More information about the Python-list mailing list