Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c772372

Browse files
committed
Remove remaining references to UserDict module.
1 parent 79e4803 commit c772372

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

Doc/library/shelve.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Restrictions
8080

8181
.. class:: Shelf(dict[, protocol=None[, writeback=False]])
8282

83-
A subclass of :class:`UserDict.DictMixin` which stores pickled values in the
84-
*dict* object.
83+
A subclass of :class:`collections.MutableMapping` which stores pickled values
84+
in the *dict* object.
8585

8686
By default, version 0 pickles are used to serialize values. The version of the
8787
pickle protocol can be specified with the *protocol* parameter. See the

Doc/reference/datamodel.rst

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,26 +1554,25 @@ either to emulate a sequence or to emulate a mapping; the difference is that for
15541554
a sequence, the allowable keys should be the integers *k* for which ``0 <= k <
15551555
N`` where *N* is the length of the sequence, or slice objects, which define a
15561556
range of items. It is also recommended that mappings provide the methods
1557-
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`,
1558-
:meth:`clear`, :meth:`setdefault`,
1559-
:meth:`pop`, :meth:`popitem`, :meth:`copy`, and
1557+
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`, :meth:`clear`,
1558+
:meth:`setdefault`, :meth:`pop`, :meth:`popitem`, :meth:`copy`, and
15601559
:meth:`update` behaving similar to those for Python's standard dictionary
1561-
objects. The :mod:`UserDict` module provides a :class:`DictMixin` class to help
1562-
create those methods from a base set of :meth:`__getitem__`,
1563-
:meth:`__setitem__`, :meth:`__delitem__`, and :meth:`keys`. Mutable sequences
1564-
should provide methods :meth:`append`, :meth:`count`, :meth:`index`,
1565-
:meth:`extend`, :meth:`insert`, :meth:`pop`, :meth:`remove`, :meth:`reverse` and
1566-
:meth:`sort`, like Python standard list objects. Finally, sequence types should
1567-
implement addition (meaning concatenation) and multiplication (meaning
1568-
repetition) by defining the methods :meth:`__add__`, :meth:`__radd__`,
1569-
:meth:`__iadd__`, :meth:`__mul__`, :meth:`__rmul__` and :meth:`__imul__`
1570-
described below; they should not define other numerical operators. It is
1571-
recommended that both mappings and sequences implement the :meth:`__contains__`
1572-
method to allow efficient use of the ``in`` operator; for mappings, ``in``
1573-
should search the mapping's keys; for sequences, it should search
1574-
through the values. It is further recommended that both mappings and sequences
1575-
implement the :meth:`__iter__` method to allow efficient iteration through the
1576-
container; for mappings, :meth:`__iter__` should be the same as
1560+
objects. The :mod:`collections` module provides a :class:`MutableMapping`
1561+
abstract base class to help create those methods from a base set of
1562+
:meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__`, and :meth:`keys`.
1563+
Mutable sequences should provide methods :meth:`append`, :meth:`count`,
1564+
:meth:`index`, :meth:`extend`, :meth:`insert`, :meth:`pop`, :meth:`remove`,
1565+
:meth:`reverse` and :meth:`sort`, like Python standard list objects. Finally,
1566+
sequence types should implement addition (meaning concatenation) and
1567+
multiplication (meaning repetition) by defining the methods :meth:`__add__`,
1568+
:meth:`__radd__`, :meth:`__iadd__`, :meth:`__mul__`, :meth:`__rmul__` and
1569+
:meth:`__imul__` described below; they should not define other numerical
1570+
operators. It is recommended that both mappings and sequences implement the
1571+
:meth:`__contains__` method to allow efficient use of the ``in`` operator; for
1572+
mappings, ``in`` should search the mapping's keys; for sequences, it should
1573+
search through the values. It is further recommended that both mappings and
1574+
sequences implement the :meth:`__iter__` method to allow efficient iteration
1575+
through the container; for mappings, :meth:`__iter__` should be the same as
15771576
:meth:`keys`; for sequences, it should iterate through the values.
15781577

15791578
.. method:: object.__len__(self)

0 commit comments

Comments
 (0)