并行复杂的Python For循环

时间:2019-04-23 11:15:16

标签: python parallel-processing multiprocessing

多重处理对我来说是新手,我正在努力了解如何将其应用于此for循环:

for ind, creature in enumerate(creatureList):
        absorbA, effectivity, creativity = effectiveArea(creature, distance, yaw)
        fitness = (absorbA * effectivity) / creativity
        creatureList[ind] = (creatureList[ind], absorbA, effectivity, creativity, fitness)

对我来说,困难在于for循环中的每一行都取决于前一行的执行,但是,整个for循环可以在独立的线程上运行以最小化计算时间。

0 个答案:

没有答案