Skip to content

Instantly share code, notes, and snippets.

@Hammer2900
Created June 7, 2015 19:18
Show Gist options
  • Select an option

  • Save Hammer2900/acc80fdd1764169eae6a to your computer and use it in GitHub Desktop.

Select an option

Save Hammer2900/acc80fdd1764169eae6a to your computer and use it in GitHub Desktop.
Function time calculate, decorator
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print '%r (%r, %r) %2.2f sec' % \
(method.__name__, args, kw, te - ts)
return result
return timed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment