This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Nested list in Dict, multiprocessing manager
Type: behavior Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: munky99999
Priority: normal Keywords:

Created on 2022-03-16 17:16 by munky99999, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (1)
msg415353 - (view) Author: munky (munky99999) Date: 2022-03-16 17:16
Sorry for this post but I found an unusual behaviour.

from multiprocessing import Manager
manager = Manager()

managerdict = manager.dict()

managerdict["first"]= {"stat" : [0,1]}

managerdict["first"]["stat"][0] += 1
managerdict["first"]["stat"][1] += 1

print(managerdict)

anotherdict = {}
anotherdict['foo'] = {"stat" : [0, 1]}
anotherdict['foo']["stat"][0] += 1
anotherdict['foo']["stat"][1] += 1

print(anotherdict)

Which outputs:

{'first': {'stat': [0, 1]}}
{'foo': {'stat': [1, 2]}}

What am I doing wrong?

Thanks!
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91192
2022-03-16 18:08:34munky99999setstatus: open -> closed
resolution: duplicate
stage: resolved
2022-03-16 17:16:49munky99999create