def timings_out(reps, func, *args, **kw):
 reps = int(reps)
 assert (reps >= 1), 'reps must be >= 1'
 if (reps == 1):
  start = clock()
  out = func(*args, **kw)
  tot_time = (clock() - start)
 else:
  rng = range((reps - 1))
  start = clock()
  for dummy in rng:
   func(*args, **kw)
  out = func(*args, **kw)
  tot_time = (clock() - start)
 av_time = (tot_time / reps)
 return (tot_time, av_time, out)

def timings_out ( reps , func , * args , ** kw ) : reps = int ( reps ) assert ( reps >= 1 ) , 'reps must be >= 1' if ( reps == 1 ) : start = clock ( ) out = func ( * args , ** kw ) tot_time = ( clock ( ) - start ) else : rng = range ( ( reps - 1 ) ) start = clock ( ) for dummy in rng : func ( * args , ** kw ) out = func ( * args , ** kw ) tot_time = ( clock ( ) - start ) av_time = ( tot_time / reps ) return ( tot_time , av_time , out )
timings_out -> execute a function reps times .