Issue with setting value for Python class inherited from multiprocessing.Process
问题 Why this code import multiprocessing import time class Bot(multiprocessing.Process): def __init__(self): self.val = 0 multiprocessing.Process.__init__(self) def setVal(self): self.val = 99 def run(self): while True: print 'IN: ', self.val time.sleep(2) if __name__ == '__main__': bot = Bot() bot.start() bot.setVal() while True: print 'OUT: ', bot.val time.sleep(2) gives following output? OUT: 99 IN: 0 OUT: 99 IN: 0 OUT: 99 IN: 0 OUT: 99 IN: 0 OUT: 99 IN: 0 OUT: 99 IN: 0 ... As you may guess i