From 765a0f7865d6e0d1667c2156d8437bcf75c5174f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Tue, 5 Mar 2024 19:30:19 +0100
Subject: [PATCH] improve CAHBI

---
 satella/coding/structures/mixins/hashable.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/satella/coding/structures/mixins/hashable.py b/satella/coding/structures/mixins/hashable.py
index 41561f2e..404cbd3c 100644
--- a/satella/coding/structures/mixins/hashable.py
+++ b/satella/coding/structures/mixins/hashable.py
@@ -191,14 +191,13 @@ def _generic_eq(self, other, truth, comparator):
     if not isinstance(other, type(self)):
         return truth
 
-    cmpr_by = self._HASH_FIELDS_TO_USE
+    cmpr_by = self._HASH_FIELDS_TO_USE      # pylint: disable=protected-access
     try:
         if isinstance(cmpr_by, str):
             return comparator(getattr(self, cmpr_by), getattr(other, cmpr_by))
 
-        for field_name in cmpr_by:
-            if getattr(self, field_name) != getattr(other, field_name):
-                return truth
+        if any(getattr(self, field_name) != getattr(other, field_name) for field_name in cmpr_by):
+            return truth
         return not truth
     except AttributeError:
         return truth
-- 
GitLab