I'd like to time a block of code without putting it in a separate function. for example:
def myfunc:
# some code here
t1 = time.time()
# block of code to time here
t2 = time.time()
print "Code took %s seconds." %(str(t2-t1))
however, I'd like to do this with the timeit module in a cleaner way, but I don't want to make a separate function for the block of code.
thanks.