summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-15 16:19:43 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-15 16:19:43 (GMT)
commit3ed4114f7d3aa14dafe830e50c569438b4b5afcb (patch)
tree10f7a9119ed4a052a4e6198597f1f88c49149d84 /Doc
parentc1c4bf85c1431d24f8960c4c7b4df3971ec9e8ed (diff)
downloadcpython-3ed4114f7d3aa14dafe830e50c569438b4b5afcb.zip
cpython-3ed4114f7d3aa14dafe830e50c569438b4b5afcb.tar.gz
cpython-3ed4114f7d3aa14dafe830e50c569438b4b5afcb.tar.bz2
#9801: document how list and dict proxies created by Managers behave w.r.t. mutable items.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/multiprocessing.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index f8327ec..09d6de9 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -1284,6 +1284,24 @@ their parent process exits. The manager classes are defined in the
Create a shared ``list`` object and return a proxy for it.
+ .. note::
+
+ Modifications to mutable values or items in dict and list proxies will not
+ be propagated through the manager, because the proxy has no way of knowing
+ when its values or items are modified. To modify such an item, you can
+ re-assign the modified object to the container proxy::
+
+ # create a list proxy and append a mutable object (a dictionary)
+ lproxy = manager.list()
+ lproxy.append({})
+ # now mutate the dictionary
+ d = lproxy[0]
+ d['a'] = 1
+ d['b'] = 2
+ # at this point, the changes to d are not yet synced, but by
+ # reassigning the dictionary, the proxy is notified of the change
+ lproxy[0] = d
+
Namespace objects
>>>>>>>>>>>>>>>>>