Message336642
I'm creating a shared dict for multiprocessing purposes:
from multiprocessing import Manager
manager = Manager()
shared_dict = manager.dict()
If I add a set or a list as a value in the dict:
shared_dict['test'] = set() or shared_dict['test'] = list()
I can't add/append in that set/list inside the shared dictionary:
shared_dict['test'].add(1234) or shared_dict['test'].append(1234)
The following expression:
print(dict(shared_dict))
Will return:
{'test': set()} or {'test': []}.
But if I add in the set/list using operators:
shared_dict['test'] |= {1234} or shared_dict['test'] += [1234]
It will work:
{'test': {1234}} or {'test': [1234]}. |
|
Date |
User |
Action |
Args |
2019-02-26 10:47:13 | andrei2peu | set | recipients:
+ andrei2peu |
2019-02-26 10:47:13 | andrei2peu | set | messageid: <1551178033.97.0.988149024615.issue36119@roundup.psfhosted.org> |
2019-02-26 10:47:13 | andrei2peu | link | issue36119 messages |
2019-02-26 10:47:13 | andrei2peu | create | |
|