Popular recipes by Carl Banks http://code.activestate.com/recipes/users/686106/2008-12-04T23:27:13-08:00ActiveState Code RecipesInterruptible Queue (Python)
2008-12-04T23:27:13-08:00Carl Bankshttp://code.activestate.com/recipes/users/686106/http://code.activestate.com/recipes/576461-interruptible-queue/
<p style="color: grey">
Python
recipe 576461
by <a href="/recipes/users/686106/">Carl Banks</a>
(<a href="/recipes/tags/queue/">queue</a>).
Revision 3.
</p>
<p>A Queue that allows the producer thread to raise an exception in the consumer threads, or vice versa.</p>
Private attributes in CPython (Python)
2008-06-05T04:40:14-07:00Carl Bankshttp://code.activestate.com/recipes/users/686106/http://code.activestate.com/recipes/573442-private-attributes-in-cpython/
<p style="color: grey">
Python
recipe 573442
by <a href="/recipes/users/686106/">Carl Banks</a>
(<a href="/recipes/tags/oop/">oop</a>).
</p>
<p>Metaclass that allows for private attributes. Classes can ensure privacy of their data by checking the stack frame inside __setattr__ and __getattribute__ to see if the function requesting the attribute was defined as part of the class.</p>
Elisp code to insert super calls in Emacs (Python)
2007-06-24T11:49:28-07:00Carl Bankshttp://code.activestate.com/recipes/users/686106/http://code.activestate.com/recipes/522990-elisp-code-to-insert-super-calls-in-emacs/
<p style="color: grey">
Python
recipe 522990
by <a href="/recipes/users/686106/">Carl Banks</a>
.
</p>
<p>This elisp code creates a key binding which inserts a new-style call to the base class method (using super) with the appropriate class and method name. For instance, if the point is inside method __init__ in class Widget, typing C-c C-f will insert the text "super(Widget,self).__init__()".</p>
<p>Requires Emacs and python-mode.el.</p>
with-open-file block in Python (Python)
2005-03-14T09:06:02-08:00Carl Bankshttp://code.activestate.com/recipes/users/686106/http://code.activestate.com/recipes/391199-with-open-file-block-in-python/
<p style="color: grey">
Python
recipe 391199
by <a href="/recipes/users/686106/">Carl Banks</a>
(<a href="/recipes/tags/files/">files</a>).
Revision 3.
</p>
<p>One can (ab)use this decorator to get the effect of a Lisp-like with_open_file block in Python. Kind of. Requires Python 2.4.</p>