Skip to content

Commit bde5537

Browse files
committed
issue25982 - Add a class definition for managers.Namespace in the multiprocessing docs.
1 parent df85859 commit bde5537

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Doc/library/multiprocessing.rst

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ However, if you really do need to use some shared data then
316316
proxies.
317317

318318
A manager returned by :func:`Manager` will support types
319-
:class:`list`, :class:`dict`, :class:`Namespace`, :class:`Lock`,
319+
:class:`list`, :class:`dict`, :class:`~managers.Namespace`, :class:`Lock`,
320320
:class:`RLock`, :class:`Semaphore`, :class:`BoundedSemaphore`,
321321
:class:`Condition`, :class:`Event`, :class:`Barrier`,
322322
:class:`Queue`, :class:`Value` and :class:`Array`. For example, ::
@@ -1747,24 +1747,26 @@ their parent process exits. The manager classes are defined in the
17471747
lproxy[0] = d
17481748

17491749

1750-
Namespace objects
1751-
>>>>>>>>>>>>>>>>>
1750+
.. class:: Namespace
17521751

1753-
A namespace object has no public methods, but does have writable attributes.
1754-
Its representation shows the values of its attributes.
1752+
A type that can register with :class:`SyncManager`.
17551753

1756-
However, when using a proxy for a namespace object, an attribute beginning with
1757-
``'_'`` will be an attribute of the proxy and not an attribute of the referent:
1754+
A namespace object has no public methods, but does have writable attributes.
1755+
Its representation shows the values of its attributes.
17581756

1759-
.. doctest::
1757+
However, when using a proxy for a namespace object, an attribute beginning
1758+
with ``'_'`` will be an attribute of the proxy and not an attribute of the
1759+
referent:
1760+
1761+
.. doctest::
17601762

1761-
>>> manager = multiprocessing.Manager()
1762-
>>> Global = manager.Namespace()
1763-
>>> Global.x = 10
1764-
>>> Global.y = 'hello'
1765-
>>> Global._z = 12.3 # this is an attribute of the proxy
1766-
>>> print(Global)
1767-
Namespace(x=10, y='hello')
1763+
>>> manager = multiprocessing.Manager()
1764+
>>> Global = manager.Namespace()
1765+
>>> Global.x = 10
1766+
>>> Global.y = 'hello'
1767+
>>> Global._z = 12.3 # this is an attribute of the proxy
1768+
>>> print(Global)
1769+
Namespace(x=10, y='hello')
17681770

17691771

17701772
Customized managers

0 commit comments

Comments
 (0)