Although this question seems very repetitive, I definitely don't know what may I doing wrong.
The following example provided by Python docs and many others I have tried, are totally ignoring target function variable setting.
I'm running it on Python 3.7.3 using Jupyter Notebook and Windows. But I also faced with this same problem using Linux.
I have no idea what is going on, it looks there are some extra config in order to make possible to share state between processes.
from multiprocessing import Process, Value, Array
def f(n, a):
n.value = 3.1415927
for i in range(len(a)):
a[i] = -a[i]
if __name__ == '__main__':
num = Value('d', 0.0)
arr = Array('i', range(10))
p = Process(target=f, args=(num, arr))
p.start()
p.join()
print(num.value)
print(arr[:])
# Expected Return
# 3.1415927
# [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
# My Return
# 0.0
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]