Popular recipes by Daniel Brodie http://code.activestate.com/recipes/users/1892511/2009-02-25T07:39:52-08:00ActiveState Code RecipesNicer struct syntax thanks to Py3 metaclasses (Python)
2009-02-25T07:39:52-08:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/576666-nicer-struct-syntax-thanks-to-py3-metaclasses/
<p style="color: grey">
Python
recipe 576666
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/parsing/">parsing</a>, <a href="/recipes/tags/py3/">py3</a>, <a href="/recipes/tags/struct/">struct</a>).
</p>
<p>This is a quick-hack module I wrote up in a couple of hours that allows for a nicer syntax to build up struct-like binary packing and unpacking. The point was to get it to be concise and as C-like as possible. This script requires python3 for it's improved metaclass support.</p>
Simple Decorators Decleration (Python)
2005-07-18T14:29:09-07:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/437086-simple-decorators-decleration/
<p style="color: grey">
Python
recipe 437086
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
.
</p>
<p>This is meant to be a method for writing decorators very easily.</p>
Simple Singleton (Python)
2005-04-28T12:14:52-07:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/412551-simple-singleton/
<p style="color: grey">
Python
recipe 412551
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/extending/">extending</a>).
</p>
<p>This is an implementation of the singleton without using the __new__ class but by implementing the __call__ method in the metaclass.</p>
Extending Classes (Python)
2005-04-29T12:46:43-07:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/412717-extending-classes/
<p style="color: grey">
Python
recipe 412717
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/oop/">oop</a>).
</p>
<p>Two implementations for extending an exsisting class using metaclasses</p>
Simpler item retrieval using tupled subscripting (Python)
2004-09-25T18:56:33-07:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/305320-simpler-item-retrieval-using-tupled-subscripting/
<p style="color: grey">
Python
recipe 305320
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/shortcuts/">shortcuts</a>).
Revision 2.
</p>
<p>The following recite shows a small addition to the tuple, list, and dictionary classes to allow for a simpler way to retrieve a number of independant items. By allowed for the subscripting to use tuples some very annoying cases becomes much simpler.</p>