请问,全局变量不在子进程里更新,但是在子进程使用的时候,全局变量没有变化
from collections import defaultdict
__global = 1
def a(x):
g = __global
print("x:{}".format(x))
print("g:{}".format(g))
def b():
global __global
__global = 2
with ProcessPoolExecutor(max_workers=1) as executor:
executor.map(a, [1, 2])
if __name__ == '__main__':
b()