From 421bb597db7c0fed43ff38129219f821e71a8310 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Fri, 24 Feb 2023 21:44:33 -0800 Subject: [PATCH] Fix bug with Set equality/inequality --- src/sage/sets/set.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sage/sets/set.py b/src/sage/sets/set.py index b988525a880..c4e39fd3df7 100644 --- a/src/sage/sets/set.py +++ b/src/sage/sets/set.py @@ -1061,10 +1061,20 @@ def __richcmp__(self, other, op): False sage: Set([1]) == set([1]) True + + Test set equality and inequality:: + + sage: L = {0} + sage: S = Set(L) + sage: S == L + True + sage: S != L + False """ if not isinstance(other, Set_object_enumerated): if isinstance(other, (set, frozenset)): - return self.set() == other + if self.set() == other: + return rich_to_bool(op, 0) return NotImplemented if self.set() == other.set(): return rich_to_bool(op, 0)