https://github.com/python/cpython/commit/8ec36f14a552136d54072e3e5bb595ec1f4f0b5f
commit: 8ec36f14a552136d54072e3e5bb595ec1f4f0b5f
branch: main
author: Paper Moon <[email protected]>
committer: picnixz <[email protected]>
date: 2026-06-29T11:56:41+02:00
summary:

gh-152359: Update numbers.rst to reference numeric-hash docs (#152549)

Co-authored-by: Bénédikt Tran <[email protected]>

files:
M Doc/library/numbers.rst

diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst
index 57b35017072c97..0ed24b4e6c5225 100644
--- a/Doc/library/numbers.rst
+++ b/Doc/library/numbers.rst
@@ -90,20 +90,7 @@ Notes for type implementers
 
 Implementers should be careful to make equal numbers equal and hash
 them to the same values. This may be subtle if there are two different
-extensions of the real numbers. For example, :class:`fractions.Fraction`
-implements :func:`hash` as follows::
-
-    def __hash__(self):
-        if self.denominator == 1:
-            # Get integers right.
-            return hash(self.numerator)
-        # Expensive check, but definitely correct.
-        if self == float(self):
-            return hash(float(self))
-        else:
-            # Use tuple's hash to avoid a high collision rate on
-            # simple fractions.
-            return hash((self.numerator, self.denominator))
+extensions of the real numbers. See also :ref:`numeric-hash`.
 
 
 Adding More Numeric ABCs

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to