diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-24 06:05:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 06:05:00 (GMT) |
commit | 2e576f5aec1f8f23f07001e2eb3db9276851a4fc (patch) | |
tree | 0c42af143f2ab71bce5865aa72056330fcc510db /Doc/reference | |
parent | 9eb5ca0774f94215be48442100c829db2484e146 (diff) | |
download | cpython-2e576f5aec1f8f23f07001e2eb3db9276851a4fc.zip cpython-2e576f5aec1f8f23f07001e2eb3db9276851a4fc.tar.gz cpython-2e576f5aec1f8f23f07001e2eb3db9276851a4fc.tar.bz2 |
bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263)
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 35925a0..058fa90 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1375,7 +1375,7 @@ Basic customization :meth:`__hash__` method of a class is ``None``, instances of the class will raise an appropriate :exc:`TypeError` when a program attempts to retrieve their hash value, and will also be correctly identified as unhashable when - checking ``isinstance(obj, collections.Hashable)``. + checking ``isinstance(obj, collections.abc.Hashable)``. If a class that overrides :meth:`__eq__` needs to retain the implementation of :meth:`__hash__` from a parent class, the interpreter must be told this @@ -1385,7 +1385,7 @@ Basic customization support, it should include ``__hash__ = None`` in the class definition. A class which defines its own :meth:`__hash__` that explicitly raises a :exc:`TypeError` would be incorrectly identified as hashable by - an ``isinstance(obj, collections.Hashable)`` call. + an ``isinstance(obj, collections.abc.Hashable)`` call. .. note:: @@ -1981,7 +1981,7 @@ range of items. It is also recommended that mappings provide the methods :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`, :meth:`clear`, :meth:`setdefault`, :meth:`pop`, :meth:`popitem`, :meth:`!copy`, and :meth:`update` behaving similar to those for Python's standard dictionary -objects. The :mod:`collections` module provides a +objects. The :mod:`collections.abc` module provides a :class:`~collections.abc.MutableMapping` abstract base class to help create those methods from a base set of :meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__`, and :meth:`keys`. |