]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130130: Clarify `hash=False` docs in `dataclasses.field` (#130324)
authorSabfo <alpha.sabfo@gmail.com>
Thu, 20 Feb 2025 07:43:27 +0000 (09:43 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2025 07:43:27 +0000 (02:43 -0500)
Doc/library/dataclasses.rst

index e34b2db02109601003019f9719187d7a37e47b44..f63a01e9570791970cdb51666f7bdb7856f9b55a 100644 (file)
@@ -270,10 +270,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``