Popular recipes by Connelly Barnes http://code.activestate.com/recipes/users/1859269/2006-09-17T23:46:45-07:00ActiveState Code RecipesTime sections of code by using "with" statement (Python)
2006-09-17T23:46:45-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/498113-time-sections-of-code-by-using-with-statement/
<p style="color: grey">
Python
recipe 498113
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
</p>
<p>This recipe allows one to use the "with" statement to time sections of code.</p>
Create Numeric/numarray/numpy array from iterator (Python)
2006-03-31T20:11:03-08:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/476217-create-numericnumarraynumpy-array-from-iterator/
<p style="color: grey">
Python
recipe 476217
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
(<a href="/recipes/tags/programs/">programs</a>).
Revision 2.
</p>
<p>The 3 Python array packages are not able to create multidimensional arrays from iterators. This recipe allows you to do that.</p>
Memoization with cache cleared on return of last function call (Python)
2005-10-09T01:39:47-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/440678-memoization-with-cache-cleared-on-return-of-last-f/
<p style="color: grey">
Python
recipe 440678
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
Revision 4.
</p>
<p>Memoize, but clear cache when last function call returns. Suitable for dynamic programming.</p>
List mixin (Python)
2005-10-10T02:07:19-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/440656-list-mixin/
<p style="color: grey">
Python
recipe 440656
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
Revision 7.
</p>
<p>Use ListMixin to create custom list classes from a small subset of list methods.</p>
Memory compacted list of bits (Python)
2005-10-10T02:08:35-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/440658-memory-compacted-list-of-bits/
<p style="color: grey">
Python
recipe 440658
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
.
Revision 5.
</p>
<p>A list of bits, compacted in memory so that 8 elements use 1 byte of storage.</p>
Determine function execution time in a Pythonic manner (Python)
2005-10-07T03:33:29-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/440657-determine-function-execution-time-in-a-pythonic-ma/
<p style="color: grey">
Python
recipe 440657
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
.
Revision 5.
</p>
<p>Module timeit requires you to specify the number of iterations for the timing loop. This module does not.</p>
Natural string sorting (Python)
2004-06-10T14:08:13-07:00Connelly Barneshttp://code.activestate.com/recipes/users/1859269/http://code.activestate.com/recipes/285264-natural-string-sorting/
<p style="color: grey">
Python
recipe 285264
by <a href="/recipes/users/1859269/">Connelly Barnes</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>Sorts strings in a way that seems natural to humans. If the
strings contain integers, then the integers are ordered
numerically. For example, sorts ['Team 11', 'Team 3', 'Team 1']
into the order ['Team 1', 'Team 3', 'Team 11'].</p>