diff --git a/satella/coding/structures/mixins/hashable.py b/satella/coding/structures/mixins/hashable.py index 41561f2e07141229167f5bb2319c2189c5ed5a6a..404cbd3c974277b9e7a55f46197e0e3ec15ce78a 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