Popular recipes by Tal Einat http://code.activestate.com/recipes/users/2892534/2014-03-29T12:43:26-07:00ActiveState Code RecipesReversed Ranges (Python)
2014-03-29T12:43:26-07:00Tal Einathttp://code.activestate.com/recipes/users/2892534/http://code.activestate.com/recipes/576801-reversed-ranges/
<p style="color: grey">
Python
recipe 576801
by <a href="/recipes/users/2892534/">Tal Einat</a>
(<a href="/recipes/tags/iteration/">iteration</a>, <a href="/recipes/tags/range/">range</a>, <a href="/recipes/tags/reverse/">reverse</a>).
Revision 16.
</p>
<p>A simple function for efficiently iterating over ranges in reverse.</p>
<p>This is equivalent to reversed(range(...)) but somewhat more efficient.</p>
Simple lock-queue via Memcached (Python)
2008-11-19T01:32:07-08:00Tal Einathttp://code.activestate.com/recipes/users/2892534/http://code.activestate.com/recipes/576567-simple-lock-queue-via-memcached/
<p style="color: grey">
Python
recipe 576567
by <a href="/recipes/users/2892534/">Tal Einat</a>
(<a href="/recipes/tags/concurrency/">concurrency</a>, <a href="/recipes/tags/contextmanager/">contextmanager</a>, <a href="/recipes/tags/lock/">lock</a>, <a href="/recipes/tags/locking/">locking</a>, <a href="/recipes/tags/memcache/">memcache</a>, <a href="/recipes/tags/memcached/">memcached</a>, <a href="/recipes/tags/queue/">queue</a>).
</p>
<p>A simple lock-queue (FIFO) context manager implemented with <a href="http://www.danga.com/memcached/">Memcached</a>.</p>
<p>In essence this is a normal lock, where the requests to acquire the lock are granted in the order in which they were originally made. Note that requests to acquire the lock are always blocking.</p>