如果主python程序首先初始化一组模块,然后等待运行它们的defRun()
函数,那么如果发生更改,它将在何时重新编译模块
考虑下面的例子…
主脚本
import mod_a
import mod_b
import mod_c
a = mod_a(<arg>)
b = mod_b(<arg>)
c = mod_c(<arg>)
list_to_run = [a, b, c]
for module in list_to_run:
module.Run()
假设mod_a.Run()和mod_b.Run()需要一些时间来运行
我开始主脚本
当mod_a.Run()
运行时,我在mod_c.Run()
中进行更改并删除mod_c.pyc
文件
当主脚本调用mod_c.Run()
时,它会重新编译并合并更改吗
编译在导入时进行。一旦你导入它,你甚至可以删除源文件,它仍然可以工作
相关问题 更多 >
编程相关推荐