Skip to content

Commit 3690688

Browse files
authored
GH-101898: Fix missing term references for hashable definition (#101899)
Fix missing term references for hashable definition
1 parent e5da9ab commit 3690688

16 files changed

+22
-22
lines changed

Doc/c-api/dict.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Dictionary Objects
8080
8181
.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
8282
83-
Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
83+
Remove the entry in dictionary *p* with key *key*. *key* must be :term:`hashable`;
8484
if it isn't, :exc:`TypeError` is raised.
8585
If *key* is not in the dictionary, :exc:`KeyError` is raised.
8686
Return ``0`` on success or ``-1`` on failure.

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Object Protocol
281281
282282
.. c:function:: Py_hash_t PyObject_HashNotImplemented(PyObject *o)
283283
284-
Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and return ``-1``.
284+
Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` and return ``-1``.
285285
This function receives special treatment when stored in a ``tp_hash`` slot,
286286
allowing a type to explicitly indicate to the interpreter that it is not
287287
hashable.

Doc/faq/programming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ method result will be released right away. The disadvantage is that if
19791979
instances accumulate, so too will the accumulated method results. They
19801980
can grow without bound.
19811981

1982-
The *lru_cache* approach works with methods that have hashable
1982+
The *lru_cache* approach works with methods that have :term:`hashable`
19831983
arguments. It creates a reference to the instance unless special
19841984
efforts are made to pass in weak references.
19851985

Doc/library/abc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The :mod:`collections` module has some concrete classes that derive from
2121
ABCs; these can, of course, be further derived. In addition, the
2222
:mod:`collections.abc` submodule has some ABCs that can be used to test whether
2323
a class or instance provides a particular interface, for example, if it is
24-
hashable or if it is a mapping.
24+
:term:`hashable` or if it is a mapping.
2525

2626

2727
This module provides the metaclass :class:`ABCMeta` for defining ABCs and

Doc/library/collections.abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
This module provides :term:`abstract base classes <abstract base class>` that
2424
can be used to test whether a class provides a particular interface; for
25-
example, whether it is hashable or whether it is a mapping.
25+
example, whether it is :term:`hashable` or whether it is a mapping.
2626

2727
An :func:`issubclass` or :func:`isinstance` test for an interface works in one
2828
of three ways.
@@ -406,7 +406,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
406406
(3)
407407
The :class:`Set` mixin provides a :meth:`_hash` method to compute a hash value
408408
for the set; however, :meth:`__hash__` is not defined because not all sets
409-
are hashable or immutable. To add set hashability using mixins,
409+
are :term:`hashable` or immutable. To add set hashability using mixins,
410410
inherit from both :meth:`Set` and :meth:`Hashable`, then define
411411
``__hash__ = Set._hash``.
412412

Doc/library/collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
2525
:func:`namedtuple` factory function for creating tuple subclasses with named fields
2626
:class:`deque` list-like container with fast appends and pops on either end
2727
:class:`ChainMap` dict-like class for creating a single view of multiple mappings
28-
:class:`Counter` dict subclass for counting hashable objects
28+
:class:`Counter` dict subclass for counting :term:`hashable` objects
2929
:class:`OrderedDict` dict subclass that remembers the order entries were added
3030
:class:`defaultdict` dict subclass that calls a factory function to supply missing values
3131
:class:`UserDict` wrapper around dictionary objects for easier dict subclassing
@@ -242,7 +242,7 @@ For example::
242242

243243
.. class:: Counter([iterable-or-mapping])
244244

245-
A :class:`Counter` is a :class:`dict` subclass for counting hashable objects.
245+
A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` objects.
246246
It is a collection where elements are stored as dictionary keys
247247
and their counts are stored as dictionary values. Counts are allowed to be
248248
any integer value including zero or negative counts. The :class:`Counter`

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` typ
160160
share these common features:
161161

162162
- Objects of these types are immutable.
163-
- Objects of these types are hashable, meaning that they can be used as
163+
- Objects of these types are :term:`hashable`, meaning that they can be used as
164164
dictionary keys.
165165
- Objects of these types support efficient pickling via the :mod:`pickle` module.
166166

Doc/library/fractions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ another rational number, or from a string.
7777

7878
The :class:`Fraction` class inherits from the abstract base class
7979
:class:`numbers.Rational`, and implements all of the methods and
80-
operations from that class. :class:`Fraction` instances are hashable,
80+
operations from that class. :class:`Fraction` instances are :term:`hashable`,
8181
and should be treated as immutable. In addition,
8282
:class:`Fraction` has the following properties and methods:
8383

Doc/library/functools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The :mod:`functools` module defines the following functions:
147147
threads.
148148

149149
Since a dictionary is used to cache results, the positional and keyword
150-
arguments to the function must be hashable.
150+
arguments to the function must be :term:`hashable`.
151151

152152
Distinct argument patterns may be considered to be distinct calls with
153153
separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)``

Doc/library/graphlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
.. class:: TopologicalSorter(graph=None)
1919

20-
Provides functionality to topologically sort a graph of hashable nodes.
20+
Provides functionality to topologically sort a graph of :term:`hashable` nodes.
2121

2222
A topological order is a linear ordering of the vertices in a graph such that
2323
for every directed edge u -> v from vertex u to vertex v, vertex u comes
@@ -85,7 +85,7 @@
8585
.. method:: add(node, *predecessors)
8686

8787
Add a new node and its predecessors to the graph. Both the *node* and all
88-
elements in *predecessors* must be hashable.
88+
elements in *predecessors* must be :term:`hashable`.
8989

9090
If called multiple times with the same node argument, the set of
9191
dependencies will be the union of all dependencies passed in.

Doc/library/inspect.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ function.
689689
modified copy.
690690

691691
.. versionchanged:: 3.5
692-
Signature objects are picklable and hashable.
692+
Signature objects are picklable and :term:`hashable`.
693693

694694
.. attribute:: Signature.empty
695695

@@ -768,7 +768,7 @@ function.
768768
you can use :meth:`Parameter.replace` to create a modified copy.
769769

770770
.. versionchanged:: 3.5
771-
Parameter objects are picklable and hashable.
771+
Parameter objects are picklable and :term:`hashable`.
772772

773773
.. attribute:: Parameter.empty
774774

Doc/library/operator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ expect a function argument.
327327
return g
328328

329329
The items can be any type accepted by the operand's :meth:`__getitem__`
330-
method. Dictionaries accept any hashable value. Lists, tuples, and
330+
method. Dictionaries accept any :term:`hashable` value. Lists, tuples, and
331331
strings accept an index or a slice:
332332

333333
>>> itemgetter(1)('ABCDEFG')

Doc/library/pathlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ these classes, since they don't provide any operation that does system calls.
186186
General properties
187187
^^^^^^^^^^^^^^^^^^
188188

189-
Paths are immutable and hashable. Paths of a same flavour are comparable
189+
Paths are immutable and :term:`hashable`. Paths of a same flavour are comparable
190190
and orderable. These properties respect the flavour's case-folding
191191
semantics::
192192

Doc/library/stdtypes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3775,7 +3775,7 @@ copying.
37753775
>>> data
37763776
bytearray(b'z1spam')
37773777

3778-
One-dimensional memoryviews of hashable (read-only) types with formats
3778+
One-dimensional memoryviews of :term:`hashable` (read-only) types with formats
37793779
'B', 'b' or 'c' are also hashable. The hash is defined as
37803780
``hash(m) == hash(m.tobytes())``::
37813781

@@ -3789,7 +3789,7 @@ copying.
37893789

37903790
.. versionchanged:: 3.3
37913791
One-dimensional memoryviews can now be sliced.
3792-
One-dimensional memoryviews with formats 'B', 'b' or 'c' are now hashable.
3792+
One-dimensional memoryviews with formats 'B', 'b' or 'c' are now :term:`hashable`.
37933793

37943794
.. versionchanged:: 3.4
37953795
memoryview is now registered automatically with
@@ -4710,7 +4710,7 @@ support membership tests:
47104710

47114711
.. versionadded:: 3.10
47124712

4713-
Keys views are set-like since their entries are unique and hashable. If all
4713+
Keys views are set-like since their entries are unique and :term:`hashable`. If all
47144714
values are hashable, so that ``(key, value)`` pairs are unique and hashable,
47154715
then the items view is also set-like. (Values views are not treated as set-like
47164716
since the entries are generally not unique.) For set-like views, all of the

Doc/library/typing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ are intended primarily for static type checking.
439439

440440
A user-defined generic class can have ABCs as base classes without a metaclass
441441
conflict. Generic metaclasses are not supported. The outcome of parameterizing
442-
generics is cached, and most types in the typing module are hashable and
442+
generics is cached, and most types in the typing module are :term:`hashable` and
443443
comparable for equality.
444444

445445

Doc/reference/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ Basic customization
15251525
:meth:`__hash__`, its instances will not be usable as items in hashable
15261526
collections. If a class defines mutable objects and implements an
15271527
:meth:`__eq__` method, it should not implement :meth:`__hash__`, since the
1528-
implementation of hashable collections requires that a key's hash value is
1528+
implementation of :term:`hashable` collections requires that a key's hash value is
15291529
immutable (if the object's hash value changes, it will be in the wrong hash
15301530
bucket).
15311531

0 commit comments

Comments
 (0)