]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-101898: Fix missing term references for hashable definition (#101899)
authorFurkan Onder <furkanonder@protonmail.com>
Tue, 14 Feb 2023 10:20:11 +0000 (10:20 +0000)
committerGitHub <noreply@github.com>
Tue, 14 Feb 2023 10:20:11 +0000 (14:20 +0400)
Fix missing term references for hashable definition

16 files changed:
Doc/c-api/dict.rst
Doc/c-api/object.rst
Doc/faq/programming.rst
Doc/library/abc.rst
Doc/library/collections.abc.rst
Doc/library/collections.rst
Doc/library/datetime.rst
Doc/library/fractions.rst
Doc/library/functools.rst
Doc/library/graphlib.rst
Doc/library/inspect.rst
Doc/library/operator.rst
Doc/library/pathlib.rst
Doc/library/stdtypes.rst
Doc/library/typing.rst
Doc/reference/datamodel.rst

index e5f28b59a701e00f9e605a457b31d7380a4e5764..34106ee6b1f30dfdd28807c61992c4224a252450 100644 (file)
@@ -80,7 +80,7 @@ Dictionary Objects
 
 .. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
 
-   Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
+   Remove the entry in dictionary *p* with key *key*. *key* must be :term:`hashable`;
    if it isn't, :exc:`TypeError` is raised.
    If *key* is not in the dictionary, :exc:`KeyError` is raised.
    Return ``0`` on success or ``-1`` on failure.
index 5a25a2b6c9d3dbb2761cc66cfe736def6e115f4c..84c72e7e108b643c4a35dd5dffdfc60af87b4069 100644 (file)
@@ -281,7 +281,7 @@ Object Protocol
 
 .. c:function:: Py_hash_t PyObject_HashNotImplemented(PyObject *o)
 
-   Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and return ``-1``.
+   Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` and return ``-1``.
    This function receives special treatment when stored in a ``tp_hash`` slot,
    allowing a type to explicitly indicate to the interpreter that it is not
    hashable.
index ba42289f3466c2a2a4b62c752cc9d39d5a425467..38f9b171618b26b81c24d8153af5acfb500bcddd 100644 (file)
@@ -1979,7 +1979,7 @@ method result will be released right away.  The disadvantage is that if
 instances accumulate, so too will the accumulated method results.  They
 can grow without bound.
 
-The *lru_cache* approach works with methods that have hashable
+The *lru_cache* approach works with methods that have :term:`hashable`
 arguments.  It creates a reference to the instance unless special
 efforts are made to pass in weak references.
 
index 3b74622e7ff46c86722984fddaa3a17d0e011db0..274b2d69f0ab5c5de3dc5b684d680c924fa46785 100644 (file)
@@ -21,7 +21,7 @@ The :mod:`collections` module has some concrete classes that derive from
 ABCs; these can, of course, be further derived. In addition, the
 :mod:`collections.abc` submodule has some ABCs that can be used to test whether
 a class or instance provides a particular interface, for example, if it is
-hashable or if it is a mapping.
+:term:`hashable` or if it is a mapping.
 
 
 This module provides the metaclass :class:`ABCMeta` for defining ABCs and
index 132b0ce7192ac178d6e99851b61a7407945ea9d0..1ada0d352a0cc6acb57bd65f68923f09efda0675 100644 (file)
@@ -22,7 +22,7 @@
 
 This module provides :term:`abstract base classes <abstract base class>` that
 can be used to test whether a class provides a particular interface; for
-example, whether it is hashable or whether it is a mapping.
+example, whether it is :term:`hashable` or whether it is a mapping.
 
 An :func:`issubclass` or :func:`isinstance` test for an interface works in one
 of three ways.
@@ -406,7 +406,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
 (3)
    The :class:`Set` mixin provides a :meth:`_hash` method to compute a hash value
    for the set; however, :meth:`__hash__` is not defined because not all sets
-   are hashable or immutable.  To add set hashability using mixins,
+   are :term:`hashable` or immutable.  To add set hashability using mixins,
    inherit from both :meth:`Set` and :meth:`Hashable`, then define
    ``__hash__ = Set._hash``.
 
index 2cffc2300a229899c71273dd5ff637c0f74871ab..bb46782c06e1c8dbd7a2266544eedf9af35f2d4d 100644 (file)
@@ -25,7 +25,7 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
 :func:`namedtuple`      factory function for creating tuple subclasses with named fields
 :class:`deque`          list-like container with fast appends and pops on either end
 :class:`ChainMap`       dict-like class for creating a single view of multiple mappings
-:class:`Counter`        dict subclass for counting hashable objects
+:class:`Counter`        dict subclass for counting :term:`hashable` objects
 :class:`OrderedDict`    dict subclass that remembers the order entries were added
 :class:`defaultdict`    dict subclass that calls a factory function to supply missing values
 :class:`UserDict`       wrapper around dictionary objects for easier dict subclassing
@@ -242,7 +242,7 @@ For example::
 
 .. class:: Counter([iterable-or-mapping])
 
-    A :class:`Counter` is a :class:`dict` subclass for counting hashable objects.
+    A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` objects.
     It is a collection where elements are stored as dictionary keys
     and their counts are stored as dictionary values.  Counts are allowed to be
     any integer value including zero or negative counts.  The :class:`Counter`
index 2f1ab7c3dd4b51dc89a428fad250cfc61a891a82..50827b27ebea04ace4b5149ff32f4b6cca163a5a 100644 (file)
@@ -160,7 +160,7 @@ The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` typ
 share these common features:
 
 - Objects of these types are immutable.
-- Objects of these types are hashable, meaning that they can be used as
+- Objects of these types are :term:`hashable`, meaning that they can be used as
   dictionary keys.
 - Objects of these types support efficient pickling via the :mod:`pickle` module.
 
index 06b0e038c89bd0e1eaf1d8a896eb85956bdcb1c1..c61bbac892e0e43e6388028b1d52bdb5a11dbcb5 100644 (file)
@@ -77,7 +77,7 @@ another rational number, or from a string.
 
    The :class:`Fraction` class inherits from the abstract base class
    :class:`numbers.Rational`, and implements all of the methods and
-   operations from that class.  :class:`Fraction` instances are hashable,
+   operations from that class.  :class:`Fraction` instances are :term:`hashable`,
    and should be treated as immutable.  In addition,
    :class:`Fraction` has the following properties and methods:
 
index 2f0a9bd8be88155af4a1dae322728300bb917cd9..80a405e87d8d563dda9f14646240132651d38854 100644 (file)
@@ -147,7 +147,7 @@ The :mod:`functools` module defines the following functions:
    threads.
 
    Since a dictionary is used to cache results, the positional and keyword
-   arguments to the function must be hashable.
+   arguments to the function must be :term:`hashable`.
 
    Distinct argument patterns may be considered to be distinct calls with
    separate cache entries.  For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)``
index 2bc80da4ead2a252e573f202485adde3fc576343..fe7932e7a61cb55412271332de59c550993fa669 100644 (file)
@@ -17,7 +17,7 @@
 
 .. class:: TopologicalSorter(graph=None)
 
-   Provides functionality to topologically sort a graph of hashable nodes.
+   Provides functionality to topologically sort a graph of :term:`hashable` nodes.
 
    A topological order is a linear ordering of the vertices in a graph such that
    for every directed edge u -> v from vertex u to vertex v, vertex u comes
@@ -85,7 +85,7 @@
    .. method:: add(node, *predecessors)
 
       Add a new node and its predecessors to the graph. Both the *node* and all
-      elements in *predecessors* must be hashable.
+      elements in *predecessors* must be :term:`hashable`.
 
       If called multiple times with the same node argument, the set of
       dependencies will be the union of all dependencies passed in.
index 58b84a35a890e3ce2e2dcfcb269b0c0e2580bf66..9c3be5a250a67e472928cb0d529c634f4598ed09 100644 (file)
@@ -689,7 +689,7 @@ function.
    modified copy.
 
    .. versionchanged:: 3.5
-      Signature objects are picklable and hashable.
+      Signature objects are picklable and :term:`hashable`.
 
    .. attribute:: Signature.empty
 
@@ -768,7 +768,7 @@ function.
    you can use :meth:`Parameter.replace` to create a modified copy.
 
    .. versionchanged:: 3.5
-      Parameter objects are picklable and hashable.
+      Parameter objects are picklable and :term:`hashable`.
 
    .. attribute:: Parameter.empty
 
index 35e9b49ea8bccae52e3a270ba2d9b0b94903cbfb..6d90473f2367b5265463b266e5d06d9c3c64a0be 100644 (file)
@@ -327,7 +327,7 @@ expect a function argument.
           return g
 
    The items can be any type accepted by the operand's :meth:`__getitem__`
-   method.  Dictionaries accept any hashable value.  Lists, tuples, and
+   method.  Dictionaries accept any :term:`hashable` value.  Lists, tuples, and
    strings accept an index or a slice:
 
       >>> itemgetter(1)('ABCDEFG')
index f222745a2c56bcae0945f981d6144b418f113c8a..c8a734ecad8e7ba399c4365e4f099a422963c83c 100644 (file)
@@ -186,7 +186,7 @@ these classes, since they don't provide any operation that does system calls.
 General properties
 ^^^^^^^^^^^^^^^^^^
 
-Paths are immutable and hashable.  Paths of a same flavour are comparable
+Paths are immutable and :term:`hashable`.  Paths of a same flavour are comparable
 and orderable.  These properties respect the flavour's case-folding
 semantics::
 
index 0ef03035a572e5ccbb7c4325c66fc74288b3100b..98bda6ded30f795ba4ff35e2e3caff98dbd3d67b 100644 (file)
@@ -3775,7 +3775,7 @@ copying.
       >>> data
       bytearray(b'z1spam')
 
-   One-dimensional memoryviews of hashable (read-only) types with formats
+   One-dimensional memoryviews of :term:`hashable` (read-only) types with formats
    'B', 'b' or 'c' are also hashable. The hash is defined as
    ``hash(m) == hash(m.tobytes())``::
 
@@ -3789,7 +3789,7 @@ copying.
 
    .. versionchanged:: 3.3
       One-dimensional memoryviews can now be sliced.
-      One-dimensional memoryviews with formats 'B', 'b' or 'c' are now hashable.
+      One-dimensional memoryviews with formats 'B', 'b' or 'c' are now :term:`hashable`.
 
    .. versionchanged:: 3.4
       memoryview is now registered automatically with
@@ -4710,7 +4710,7 @@ support membership tests:
 
    .. versionadded:: 3.10
 
-Keys views are set-like since their entries are unique and hashable.  If all
+Keys views are set-like since their entries are unique and :term:`hashable`.  If all
 values are hashable, so that ``(key, value)`` pairs are unique and hashable,
 then the items view is also set-like.  (Values views are not treated as set-like
 since the entries are generally not unique.)  For set-like views, all of the
index 356f919a1897b29719d127b5288e96c138a3a6ff..169f7196a74ec69443767c05bdfc3776682e0dd5 100644 (file)
@@ -439,7 +439,7 @@ are intended primarily for static type checking.
 
 A user-defined generic class can have ABCs as base classes without a metaclass
 conflict. Generic metaclasses are not supported. The outcome of parameterizing
-generics is cached, and most types in the typing module are hashable and
+generics is cached, and most types in the typing module are :term:`hashable` and
 comparable for equality.
 
 
index 1d2ddf3507aee123cf1a794ec7e02453f94c95f8..e4e471e50079ae30f674fa1a87d6cac0d02a1778 100644 (file)
@@ -1525,7 +1525,7 @@ Basic customization
    :meth:`__hash__`, its instances will not be usable as items in hashable
    collections.  If a class defines mutable objects and implements an
    :meth:`__eq__` method, it should not implement :meth:`__hash__`, since the
-   implementation of hashable collections requires that a key's hash value is
+   implementation of :term:`hashable` collections requires that a key's hash value is
    immutable (if the object's hash value changes, it will be in the wrong hash
    bucket).