Latest recipes tagged "signals" Code Recipesstrsignal (Python) 2014-06-29T15:47:24-07:00Zack Weinberg <p style="color: grey"> Python recipe 578899 by <a href="/recipes/users/4190298/">Zack Weinberg</a> (<a href="/recipes/tags/signals/">signals</a>). </p> <p>This is an emulation of the standard (POSIX.1-2008) C library function <a href=""><code>strsignal()</code></a>, which should be in the <a href=""><code>signal</code> module</a>, but isn't.</p> <p>If possible, it uses <a href=""><code>ctypes</code></a> to call the C library function; otherwise, it tries to build a reverse mapping of the <code>SIG*</code> constants in the signal module; if that doesn't work either, it just produces <code>"signal %d"</code> where <code>%d</code> is the decimal signal number.</p> <p>If invoked as a script, will test all of the strategies and print the results.</p> <p>Tested in 2.7 and 3.4; <em>should</em> work with 2.6 and 3.3 as well.</p> Python: A event/signal dispatcher (Python) 2013-07-29T05:34:24-07:00Esteban Castro Borsani <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>