I am trying to understand timeit module for PYTHON.
I have a very simple function, it just prints "hi" I then used timeit module to print the time elapsed for this function, but there is one output "0.0010001659393310547" other than "0.0"
Why does this happen? How to make the output stable, which means only has one number forever? Otherwise not sure if I apply this to my project, will it give me the correct anwser...
my code as below:
>>> def hi():
... print "hi"
...
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0010001659393310547
>>> timeit.timeit(hello,number=6)
hi
hi
hi
hi
hi
hi
0.0