|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
test1_solution = copy.deepcopy(self.solution)
before_change_successful_task_num = check.returnTotalNumSuccessfulTask(self.solution)
print('before_num',before_change_successful_task_num)
current_task1.setImageChance(optional_image_chance_list1[i])
current_task2.setImageChance(optional_image_chance_list2[j])
test2_solution = copy.deepcopy(self.solution)
l = 0
for k in range(len(self.solution)):
print(len(self.solution))
if(test1_solution[k].getImageChance() == test2_solution[k].getImageChance()):
l += 1
#else:
# if(test1_solution[k].getImageChance() != None):
# print('test1_sloution',test1_solution[k].id,test1_solution[k].getImageChance().id)
# print('test2_sloution',test2_solution[k].id,test2_solution[k].getImageChance().id)
# else:
# print('test1_sloution',test1_solution[k].id,test1_solution[k].getImageChance())
# print('test2_sloution',test2_solution[k].id,test2_solution[k].getImageChance())
print('l',l)
截取了代码了一段,self.solution是由current_task元素构成的长度为6000的列表,current_task1和current_task2是其中的两个元素,setImageChance这个函数改变了元素的某个属性,上述代码总共改变了两个元素的属性,改变前后均deepcopy了一份,按理来说后续打印出来的l应该是5998,但是运行发现结果为100多,求大佬指教 |
|