Saturday, January 10, 2009

Announcing stopwatch 0.3.1

There is a new release of stopwatch, a simple utility for measuring time in Python. The release addes a simple decorator for functions to print the execution time of each call to that function.

>>> from stopwatch import clockit
>>> @clockit
def multiply(a, b):
return a * b
>>> r = multiple(4, 5)
multiple in 1.38282775879e-05 sec
>>> print r
20

You can obtain the new release with easy_install
easy_install -U stopwatch

or download the appropriate release.

2 comments:

Davey said...

Hai,
I've found your stopwatch to use in my python program, the only thing is, when trying to import it, it generates an error saying:
"SyntaxError: invalid syntax (__init__.py, line 98). I've tried solving it myself, but my knowledge of python isn't very big.. could you tell me what's wrong please? Thanks you in advance, and thank you for programming such a handy little module like this =)

vosa said...

Hi,
thank you for your program. Btw. maybe this method is good idea :)

def reset(self):self.__init__()