From 8a76758197575c38033fab61340a60fd0defe2af Mon Sep 17 00:00:00 2001 From: Nicholas Bruce Date: Thu, 27 Apr 2023 22:10:05 +0000 Subject: [PATCH] Adds __eq__ support for non-normalized fractions --- Lib/fractions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index c95db0730e5b6d..bfdba8f57037ad 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -910,7 +910,7 @@ def __hash__(self): def __eq__(a, b): """a == b""" if type(b) is int: - return a._numerator == b and a._denominator == 1 + return a._numerator / a._denominator == b if isinstance(b, numbers.Rational): return (a._numerator == b.numerator and a._denominator == b.denominator) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy