Friday, August 8, 2008

Announcing stopwatch 0.3.0 and the 7 Oars code repository

The 7 Oars code repository is a centralized location for small python programs and modules from 7 Oars, instead of having multiple wikis and source control systems for relatively small projects.

The first module as part of the code repository is stopwatch. stopwatch is a very simple python module for measuring time. I typically use it to measure the execution time of specifc parts of code or data processing threads. For example:


>>> import stopwatch
>>> t = stopwatch.Timer() # immediately starts the clock
>>> t.elapsed # elapsed time in seconds
0.2
>>> t.elapsed
1.6
>>> str(t) # pretty print
1.8 sec
>>> for i in xrange(0, 10000)
>>> pass
>>> t.elapsed # still going
10.4
>>> t.stop() # stop the timer
>>> t.elapsed
10.6
>>> t.elapsed # it will not go any more
10.6

Download: http://code.google.com/p/7oars/downloads/list

via PyPi:
easy_install -U stopwatch


via subversion:
svn checkout http://7oars.googlecode.com/svn/trunk/stopwatch stopwatch

No comments: