]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-130130: Clarify `hash=False` docs in `dataclasses.field` (GH-130324) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 20 Feb 2025 07:51:39 +0000 (08:51 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2025 07:51:39 +0000 (07:51 +0000)
gh-130130: Clarify `hash=False` docs in `dataclasses.field` (GH-130324)
(cherry picked from commit 47ace539950fb675d5968736348f0d724ba199f0)

Co-authored-by: Sabfo <alpha.sabfo@gmail.com>
Doc/library/dataclasses.rst

index cfca11afbd2e41cf4a07685a28273804889f30a2..8b1c30af193d311c18c9ee8098dce77e24a19584 100644 (file)
@@ -277,10 +277,11 @@ Module contents
      string returned by the generated :meth:`~object.__repr__` method.
 
    - *hash*: This can be a bool or ``None``.  If true, this field is
-     included in the generated :meth:`~object.__hash__` method.  If ``None`` (the
-     default), use the value of *compare*: this would normally be
-     the expected behavior.  A field should be considered in the hash
-     if it's used for comparisons.  Setting this value to anything
+     included in the generated :meth:`~object.__hash__` method.  If false,
+     this field is excluded from the generated :meth:`~object.__hash__`.
+     If ``None`` (the default), use the value of *compare*: this would
+     normally be the expected behavior, since a field should be included
+     in the hash if it's used for comparisons.  Setting this value to anything
      other than ``None`` is discouraged.
 
      One possible reason to set ``hash=False`` but ``compare=True``