Popular recipes by Thomas Ahle http://code.activestate.com/recipes/users/4060075/2011-02-13T15:27:42-08:00ActiveState Code RecipesPython Infinite Rotations and Tails (Python) 2011-02-13T15:27:42-08:00Thomas Ahlehttp://code.activestate.com/recipes/users/4060075/http://code.activestate.com/recipes/577574-python-infinite-rotations-and-tails/ <p style="color: grey"> Python recipe 577574 by <a href="/recipes/users/4060075/">Thomas Ahle</a> (<a href="/recipes/tags/cycles/">cycles</a>, <a href="/recipes/tags/functional/">functional</a>, <a href="/recipes/tags/infinite/">infinite</a>, <a href="/recipes/tags/lists/">lists</a>, <a href="/recipes/tags/rotations/">rotations</a>, <a href="/recipes/tags/tails/">tails</a>). </p> <p>This is an example of how functional ideas of infinite lists can be used in python to optimize memory usage of certain problems.</p> Run async code inline, nonblocking (Python) 2009-11-11T12:55:01-08:00Thomas Ahlehttp://code.activestate.com/recipes/users/4060075/http://code.activestate.com/recipes/576952-run-async-code-inline-nonblocking/ <p style="color: grey"> Python recipe 576952 by <a href="/recipes/users/4060075/">Thomas Ahle</a> (<a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/closure/">closure</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/threads/">threads</a>). Revision 7. </p> <p>A decorator, that makes it easy to switch between the mainthread and background threads.</p> GtkWorker (Python) 2007-06-03T09:06:42-07:00Thomas Ahlehttp://code.activestate.com/recipes/users/4060075/http://code.activestate.com/recipes/521881-gtkworker/ <p style="color: grey"> Python recipe 521881 by <a href="/recipes/users/4060075/">Thomas Ahle</a> (<a href="/recipes/tags/blocking/">blocking</a>, <a href="/recipes/tags/glib/">glib</a>, <a href="/recipes/tags/gtk/">gtk</a>, <a href="/recipes/tags/swingworker/">swingworker</a>, <a href="/recipes/tags/threads/">threads</a>). </p> <p>I got inspired to this class, after having read about the java SwingWorker. The problem is that you sometimes have a tough task you want to do in a GUI program, but you don't want the UI to lock. This recipe solves the problem by running the tough code in a background thread, while still letting you do useful interaction with it, like getting the progress or the latest results.</p>