Popular recipes by Thomas Heller http://code.activestate.com/recipes/users/98141/popular/2005-04-01T07:57:55-08:00ActiveState Code RecipesYet another timeit function (Python)
2005-04-01T07:57:55-08:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/408762-yet-another-timeit-function/
<p style="color: grey">
Python
recipe 408762
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/debugging/">debugging</a>).
</p>
<p>Here is a handy function to use the timeit module from a script, creating a nice overview of the runtimes of one or more code snippets.</p>
<p>All command line flags that the timeit module accepts can be used.</p>
<p>The output can easily be customized.</p>
Automatically start the debugger on an exception (Python)
2001-07-13T08:39:47-07:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/65287-automatically-start-the-debugger-on-an-exception/
<p style="color: grey">
Python
recipe 65287
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/debugging/">debugging</a>).
Revision 5.
</p>
<p>When Python runs a script and an uncatched exception is raised, a traceback is printed and the script is terminated.
Python2.1 has introduced sys.excepthook, which can be used to override the handling of uncaught exceptions. This allows to automatically start the debugger on an unexpected exception, even if python is not running in interactive mode.</p>
installing source distributions on windows (Python)
2002-04-10T20:04:47-07:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/117248-installing-source-distributions-on-windows/
<p style="color: grey">
Python
recipe 117248
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/sysadmin/">sysadmin</a>).
Revision 5.
</p>
<p>Distutil's bdist_wininst installers offer uninstallation support for Python extensions, many developers however only distribute sources in zip or tar.gz format. The typical steps to install such a distribution are:
- download the file
- unpack with winzip into a temporary directory
- open a command prompt and type 'python setup.py install'
- remove the temporary directory</p>
<p>This script unpacks a source distribution into a temporary directory, builds a windows installer on the fly, executes it, and cleans everything up afterward.</p>
FileSet - case insensitive but case preserving set of files (Python)
2002-01-29T23:53:14-08:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/110885-fileset-case-insensitive-but-case-preserving-set-o/
<p style="color: grey">
Python
recipe 110885
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/files/">files</a>).
</p>
<p>The filesystem on Windows usually preserves the case of filenames, but is case insensitive if you are accessing files.</p>
"Real" class methods in Python (Python)
2001-03-27T11:40:20-08:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/52311-real-class-methods-in-python/
<p style="color: grey">
Python
recipe 52311
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/oop/">oop</a>).
</p>
<p>This recipe demonstrates 'real' class methods, like they are known from Smalltalk.</p>
<p>Class methods implicitely receive the actual class as the first parameter.</p>
<p>They are inherited by subclasses, and may as well be overridden.</p>
<p>Class methods may return anything, although they are particularly useful as constructors.</p>
a Set class for python (Python)
2001-03-16T05:33:25-08:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/52258-a-set-class-for-python/
<p style="color: grey">
Python
recipe 52258
by <a href="/recipes/users/98141/">Thomas Heller</a>
(<a href="/recipes/tags/oop/">oop</a>).
</p>
<p>A Set is a collection of items containing no duplicates.</p>