A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/313584.html below:

Magic Optimisation

Magic Optimisation Magic OptimisationPaul McGuire ptmcg at austin.rr.com
Mon Sep 5 10:27:41 EDT 2005
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.

    def loop(self):
        self_pool_popleft = self.pool.popleft
        self_pool_append = self.pool.append
        self_call_exit_funcs = self.call_exit_funcs
        check = self.pool.__len__
        while check() > 0:
            try:
                while check() > 0:
                    task = self_pool_popleft()
                    task.next()
                    self_pool_append(task)
            except StopIteration:
                self_call_exit_funcs(task) 

-- Paul


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4