Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于以下代码,为什么打印出 ind.fitness 和打印出 ind.fitness.values 会返回完全相同的输出。这是否意味着方法相同或有什么不同?
for ind, fit in zip(pop, fitnesses): #print(ind, fit) ind.fitness.values = fit print("Fitness", ind.fitness) print(ind.fitness.values)
ind.fitness 是一个具有不同功能、变量等的对象。它的实现是为了打印这个对象将打印变量“values”,它是这个对象中的一个变量。