__init__(self,verbose=False):
self.verbose = verbose
def __enter__(self):
self.start = clock()
return self
def __exit__(self,*args):
self.end = clock()
self.secs = self.end - self.start
self.msecs = self.secs * 1000 # millisecs
if self.verbose:
print 'elapsed time: %f ms' % self.msecs</code></pre>