diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2016-01-20 11:11:52 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2016-01-20 11:11:52 (GMT) |
commit | 316fcc867bbae652272aefb726185c12907ba8d4 (patch) | |
tree | 08e3da5c20e2ab6d228d407c8f720803616fa26f /Doc/library | |
parent | b56837a03358ee2a3374fc0004488179c6771442 (diff) | |
parent | 6a0514ea20a516ca5973b913cf58289561a57342 (diff) | |
download | cpython-316fcc867bbae652272aefb726185c12907ba8d4.zip cpython-316fcc867bbae652272aefb726185c12907ba8d4.tar.gz cpython-316fcc867bbae652272aefb726185c12907ba8d4.tar.bz2 |
merge from 3.5
issue25982 - Add a class definition for managers.Namespace in the multiprocessing docs.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/multiprocessing.rst | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 6d17113..a9b7aa5 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -316,7 +316,7 @@ However, if you really do need to use some shared data then proxies. A manager returned by :func:`Manager` will support types - :class:`list`, :class:`dict`, :class:`Namespace`, :class:`Lock`, + :class:`list`, :class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`, :class:`Event`, :class:`Barrier`, :class:`Queue`, :class:`Value` and :class:`Array`. For example, :: @@ -1752,24 +1752,26 @@ their parent process exits. The manager classes are defined in the lproxy[0] = d -Namespace objects ->>>>>>>>>>>>>>>>> +.. class:: Namespace -A namespace object has no public methods, but does have writable attributes. -Its representation shows the values of its attributes. + A type that can register with :class:`SyncManager`. -However, when using a proxy for a namespace object, an attribute beginning with -``'_'`` will be an attribute of the proxy and not an attribute of the referent: + A namespace object has no public methods, but does have writable attributes. + Its representation shows the values of its attributes. -.. doctest:: + However, when using a proxy for a namespace object, an attribute beginning + with ``'_'`` will be an attribute of the proxy and not an attribute of the + referent: + + .. doctest:: - >>> manager = multiprocessing.Manager() - >>> Global = manager.Namespace() - >>> Global.x = 10 - >>> Global.y = 'hello' - >>> Global._z = 12.3 # this is an attribute of the proxy - >>> print(Global) - Namespace(x=10, y='hello') + >>> manager = multiprocessing.Manager() + >>> Global = manager.Namespace() + >>> Global.x = 10 + >>> Global.y = 'hello' + >>> Global._z = 12.3 # this is an attribute of the proxy + >>> print(Global) + Namespace(x=10, y='hello') Customized managers |