I'm trying to pop off the values I'm appending to the list M each time I've evaluated the difference between them and their expected values. I'm printing the result of a list before and after I use M.pop(). Is it using a location in memory and messing up my list inside of deltaL?
M=[]
delta = 3
while abs(delta) > 0.3:
for num1 in range(450,800,20):
best_config_per_numL = []
delta_mL = []
for config in ['FFF','FFS','FSF','FSS','SFF','SFS','SSF','SSS']:
M.append(gen(num1,config[0]))
M.append(gen(num1,config[1]))
M.append(gen(num1,config[2]))
xyL = []
xL = range(400,801,1)
for i in xL:
xyL.append([geny(M,i),i])
deltaL = []
yL = range(400,801,1)
for i in range(len(yL)):
expected = yL[i]
actual = xyL[i][0].real
deltaL.append(abs(expected - actual))
delta_mL.append([max(deltaL),M])
print '\n'+str(delta_mL)+'\n' #<-------------------------- LINE 1
M.pop()
M.pop()
M.pop()
print '\n'+str(delta_mL)+'\n' #<-------------------------- LINE 2
best_config_per_numL.append(delta_mL[0].sort()[0]) #best config for all lambda
M.append(best_config_per_numL.sort()[0][1])
delta = best_config_per_numL.sort()[0][0]
The output of LINE 1 is: [[1.0, [[1.9736842105263157, 57.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]]]
[[1.0, [[1.9736842105263157, 57.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.99749174811000929, [[1.9736842105263157, 57.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]]]
[[1.0, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.99749174811000929, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.90639755394574695, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]]]
[[1.0, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.99749174811000929, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.90639755394574695, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.78984872616045532, [[1.9736842105263157, 57.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]]]
[[1.0, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]], [0.99749174811000929, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]], [0.90639755394574695, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]], [0.99749174811000885, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.9736842105263157, 57.0]]]]
[[1.0, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.99749174811000929, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.90639755394574695, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.99749174811000885, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]], [0.77268527172444679, [[1.0514018691588785, 107.0], [1.9736842105263157, 57.0], [1.0514018691588785, 107.0]]]]
[[1.0, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.99749174811000929, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.90639755394574695, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.99749174811000885, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.77268527172444679, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.9736842105263157, 57.0]]]]
[[1.0, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.99749174811000929, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.90639755394574695, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.99749174811000885, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.77268527172444679, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [0.78984872616045532, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]], [1.0, [[1.0514018691588785, 107.0], [1.0514018691588785, 107.0], [1.0514018691588785, 107.0]]]]
The output of LINE 2 is: [[1.0, []], [0.99749174811000929, []], [0.90639755394574695, []], [0.78984872616045532, []], [0.99749174811000885, []], [0.77268527172444679, []], [0.78984872616045532, []], [1.0, []]]
I expected to get the same thing as LINE 1.
print...str(...)...with simplerprint "\n", max(deltaL), M, "\n"