Popular recipes tagged "long"http://code.activestate.com/recipes/tags/long/2017-02-06T18:30:18-08:00ActiveState Code RecipesLong processing computation in Tkinter or long-running task (Python) 2017-02-06T18:30:18-08:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580754-long-processing-computation-in-tkinter-or-long-run/ <p style="color: grey"> Python recipe 580754 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/computation/">computation</a>, <a href="/recipes/tags/intensive/">intensive</a>, <a href="/recipes/tags/long/">long</a>, <a href="/recipes/tags/task/">task</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). Revision 12. </p> <p>I provide in this module the function "tk_call_async": It executes a function asynchronously.</p> <pre class="prettyprint"><code>tk_call_async(window, computation, args=(), kwargs={}, callback=None, polling=100, method=MULTIPROCESSING) </code></pre> <p>"tk_call_async" executes the function "computation" asynchronously with the provided "args" and "kwargs" without blocking the tkinter event loop.</p> <p>If "callback" is provided, it will be called with the result when the computation is finished.</p> <p>If an exception happens doing the computation, the errback function is called with the exception if this is provided.</p> <p>"Polling" will be the frequency to poll to check for results.</p> <p>There is two methods to execute the task: using multiprocessing or using threads.</p> Easy Bit Arrays using Long Integers (Python) 2013-12-01T02:21:14-08:00Mike Sweeneyhttp://code.activestate.com/recipes/users/4177990/http://code.activestate.com/recipes/578777-easy-bit-arrays-using-long-integers/ <p style="color: grey"> Python recipe 578777 by <a href="/recipes/users/4177990/">Mike Sweeney</a> (<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/bit/">bit</a>, <a href="/recipes/tags/bitwise/">bitwise</a>, <a href="/recipes/tags/integer/">integer</a>, <a href="/recipes/tags/long/">long</a>). </p> <p>Some simple techniques for working with long integers as bit arrays. Python support for long integers allows fast bitwise operations on large bit arrays. Bitwise operations on 100 million bit arrays happen in the blink of an eye. They are also fast and compact when saving and loading to disk. Unfortunately bit set, get, append, pop etc are slow so another bit array technique may be preferred.</p>