Commit 6a0514ea authored by Senthil Kumaran's avatar Senthil Kumaran

issue25982 - Add a class definition for managers.Namespace in the multiprocessing docs.

parent bfd316e7
...@@ -316,7 +316,7 @@ However, if you really do need to use some shared data then ...@@ -316,7 +316,7 @@ However, if you really do need to use some shared data then
proxies. proxies.
A manager returned by :func:`Manager` will support types 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:`RLock`, :class:`Semaphore`, :class:`BoundedSemaphore`,
:class:`Condition`, :class:`Event`, :class:`Barrier`, :class:`Condition`, :class:`Event`, :class:`Barrier`,
:class:`Queue`, :class:`Value` and :class:`Array`. For example, :: :class:`Queue`, :class:`Value` and :class:`Array`. For example, ::
...@@ -1747,24 +1747,26 @@ their parent process exits. The manager classes are defined in the ...@@ -1747,24 +1747,26 @@ their parent process exits. The manager classes are defined in the
lproxy[0] = d lproxy[0] = d
Namespace objects .. class:: Namespace
>>>>>>>>>>>>>>>>>
A namespace object has no public methods, but does have writable attributes. A type that can register with :class:`SyncManager`.
Its representation shows the values of its attributes.
However, when using a proxy for a namespace object, an attribute beginning with A namespace object has no public methods, but does have writable attributes.
``'_'`` will be an attribute of the proxy and not an attribute of the referent: 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() >>> manager = multiprocessing.Manager()
>>> Global = manager.Namespace() >>> Global = manager.Namespace()
>>> Global.x = 10 >>> Global.x = 10
>>> Global.y = 'hello' >>> Global.y = 'hello'
>>> Global._z = 12.3 # this is an attribute of the proxy >>> Global._z = 12.3 # this is an attribute of the proxy
>>> print(Global) >>> print(Global)
Namespace(x=10, y='hello') Namespace(x=10, y='hello')
Customized managers Customized managers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment