I am testing an implementation of Heap using the timeit
module, but I can't get it to print time in float:
def testCustomHeapStartUp(*args):
h = MinHeap(args[0])
return True
if __name__ == "__main__":
for i in range(3):
testList = random.sample(range(100), 100)
print(timeit.Timer("testCustomHeapStartUp(testList)", \
"from __main__ import testCustomHeapStartUp; from __main__ import testList; gc.enabled()"))
This is the output:
<timeit.Timer object at 0x101a58978>
<timeit.Timer object at 0x101a58978>
<timeit.Timer object at 0x101a58978>