What code does Python's timeit(...) method actually time in this bit of code?
Question: 
    timeit.timeit("A0([randint(1,256) * (-1) ** randint(1,2) for j in range("+str(n)+")])", setup="from HW2 import A0", number=1000000)
    

I want to measure the time that the A0 algorithm takes to complete its job on
a list of size n, but I can't find a way to generate the list and then pass it
in as a variable to the timeit.timeit(...) method. Will the timer only measure
how long A0 takes to complete, or will the list generation also be included in
the measurement?


Answer: It will measure the execution time of everything in the statement ( the first
arg ), so if you only want the measurment of the call to A0, then the list
creation will skew the results.

Try creating the list in the setup:

    
    
    timeit.timeit("A0(aList)", setup="from HW2 import A0; aList = [randint(1,256) * (-1) ** randint(1,2) for j in range("+str(n)+")] ", number=1000000)
    

The list will only be created once, at the start of the timer, and not be
included in the timing.

