Popular recipes tagged "dispatcher" but not "web"http://code.activestate.com/recipes/tags/dispatcher-web/2013-07-29T05:34:24-07:00ActiveState Code RecipesPython: A event/signal dispatcher (Python)
2013-07-29T05:34:24-07:00Esteban Castro Borsanihttp://code.activestate.com/recipes/users/4184010/http://code.activestate.com/recipes/578307-python-a-eventsignal-dispatcher/
<p style="color: grey">
Python
recipe 578307
by <a href="/recipes/users/4184010/">Esteban Castro Borsani</a>
(<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/events/">events</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/signals/">signals</a>).
</p>
<p>This is a thread-safe dispatcher.</p>
Fast and elegant switch/case-like dispatch (Python)
2011-09-02T01:49:40-07:00Jan Kaliszewskihttp://code.activestate.com/recipes/users/4172762/http://code.activestate.com/recipes/577864-fast-and-elegant-switchcase-like-dispatch/
<p style="color: grey">
Python
recipe 577864
by <a href="/recipes/users/4172762/">Jan Kaliszewski</a>
(<a href="/recipes/tags/case/">case</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/switch/">switch</a>).
Revision 4.
</p>
<p>My approach to that common issue focuses on <strong>efficiency</strong> and <strong>elegant, declarative style</strong> of definition. That's why:</p>
<ul>
<li>The way switches work is based on unwrapped defaultdict/list lookup.</li>
<li>The way you define switches is based on classes and easy-to-use decorators (note that you can use subclassing in a flexible way -- without any negative impact on efficiency!).</li>
<li>Its use cases focus on a-lot-of-keys situations and it does not cover the <em>fall-through</em> feature (though you can reach its semantics if you really need that -- by calling class methods...).</li>
</ul>
A powerful yet simple switch-like dispatch system for Python (Python)
2010-12-21T04:38:48-08:00Michael Kenthttp://code.activestate.com/recipes/users/1184676/http://code.activestate.com/recipes/577507-a-powerful-yet-simple-switch-like-dispatch-system-/
<p style="color: grey">
Python
recipe 577507
by <a href="/recipes/users/1184676/">Michael Kent</a>
(<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/switch/">switch</a>).
Revision 2.
</p>
<p>This module provides a powerful 'switch'-like dispatcher system, using decorators to give a syntax somewhat like that of the switch statement in C. Values for switch cases can be anything comparable via '==', a string for use on the left-hand side of the 'in' operator, or a regular expression.
Iterables of these types can also be used.</p>
Simple event dispatcher (Python)
2010-10-19T21:18:45-07:00Daniele Espostihttp://code.activestate.com/recipes/users/4174769/http://code.activestate.com/recipes/577432-simple-event-dispatcher/
<p style="color: grey">
Python
recipe 577432
by <a href="/recipes/users/4174769/">Daniele Esposti</a>
(<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/event/">event</a>).
</p>
<p>An example of a simple event dispatcher mini-framework</p>