Created
November 10, 2011 15:56
-
-
Save GeorgeErickson/1355199 to your computer and use it in GitHub Desktop.
useful python snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def log_timing(func): | |
def wrapper(*arg): | |
t1 = time.time() | |
res = func(*arg) | |
t2 = time.time() | |
print "%s took %d ms" % (func.func_name, (t2-t1)*1000.0) | |
return res | |
return wrapper | |
def max_memory(func): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment