summaryrefslogtreecommitdiffstats
path: root/Doc/library/collections.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/collections.rst')
-rw-r--r--Doc/library/collections.rst26
1 files changed, 9 insertions, 17 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 7645f2a..80c6c76 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -76,14 +76,19 @@ The class can be used to simulate nested scopes and is useful in templating.
be modified to change which mappings are searched. The list should
always contain at least one mapping.
- .. method:: new_child()
+ .. method:: new_child(m=None)
- Returns a new :class:`ChainMap` containing a new :class:`dict` followed by
- all of the maps in the current instance. A call to ``d.new_child()`` is
- equivalent to: ``ChainMap({}, *d.maps)``. This method is used for
+ Returns a new :class:`ChainMap` containing a new map followed by
+ all of the maps in the current instance. If ``m`` is specified,
+ it becomes the new map at the front of the list of mappings; if not
+ specified, an empty dict is used, so that a call to ``d.new_child()``
+ is equivalent to: ``ChainMap({}, *d.maps)``. This method is used for
creating subcontexts that can be updated without altering values in any
of the parent mappings.
+ .. versionchanged:: 3.4
+ The optional ``m`` parameter was added.
+
.. attribute:: parents
Property returning a new :class:`ChainMap` containing all of the maps in
@@ -369,10 +374,6 @@ or subtracting from an empty counter.
.. seealso::
- * `Counter class <http://code.activestate.com/recipes/576611/>`_
- adapted for Python 2.5 and an early `Bag recipe
- <http://code.activestate.com/recipes/259174/>`_ for Python 2.4.
-
* `Bag class <http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
in Smalltalk.
@@ -915,11 +916,6 @@ and more efficient to use a simple class declaration:
>>> class Status:
open, pending, closed = range(3)
-.. seealso::
-
- * `Named tuple recipe <http://code.activestate.com/recipes/500261/>`_
- adapted for Python 2.4.
-
* `Recipe for named tuple abstract base class with a metaclass mix-in
<http://code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-for-named/>`_
by Jan Kaliszewski. Besides providing an :term:`abstract base class` for
@@ -982,10 +978,6 @@ The :class:`OrderedDict` constructor and :meth:`update` method both accept
keyword arguments, but their order is lost because Python's function call
semantics pass-in keyword arguments using a regular unordered dictionary.
-.. seealso::
-
- `Equivalent OrderedDict recipe <http://code.activestate.com/recipes/576693/>`_
- that runs on Python 2.4 or later.
:class:`OrderedDict` Examples and Recipes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^