KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The its-late-and-im-probably-stupid department presents: >>> import multiprocessing >>> mgr = multiprocessing.Manager() >>> d = mgr.dict() >>> d.setdefault('foo', []).append({'bar': 'baz'}) >>> print d.items() [('foo', [])] <-- Where did the dict go? Whereas: >>> e = mgr.dict() >>> e['foo'] = [{'bar': 'baz'}] >>> print e.items() [('foo', [{'bar': 'baz'}])] Version: >>> sys.version '2.7.2+ (default, Jan 20 2012, 23:05:38) \n[GCC 4.6.2]' Bug or wug? EDIT: More of the same, on python 3.2: >>> sys.version '3.2.2rc1 (default, Aug 14 2011, 21:09:07) \n[GCC 4.6.1]' >>> e['foo'] = [{'bar': 'baz'}] >>> print(e.items()) [('foo', [{'bar': 'baz'}])] >>> id(type(e['foo'])) 137341152 >>> id(type([])) 137341152 >>> e['foo'].append({'asdf': 'fdsa'}) >>> print(e.items()) [('foo', [{'bar': 'baz'}])] How can the list in the dict proxy not contain the additional element?
Tags (comma-separated)
Save Edits
Cancel