Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 6995d1e

Browse files
rwstMatthias Koeppe
authored and
Matthias Koeppe
committed
24171: make RealSet inherit from Set_generic
1 parent 46d9795 commit 6995d1e

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/sage/sets/real_set.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class RealSet.
8686
#*****************************************************************************
8787

8888
from sage.structure.richcmp import richcmp, richcmp_method
89-
from sage.structure.parent import Parent
89+
from sage.structure.parent import Parent, Set_generic
9090
from sage.structure.unique_representation import UniqueRepresentation
9191
from sage.categories.topological_spaces import TopologicalSpaces
9292
from sage.rings.all import ZZ
@@ -724,7 +724,7 @@ def __rmul__(self, other):
724724
return self * other
725725

726726
@richcmp_method
727-
class RealSet(UniqueRepresentation, Parent):
727+
class RealSet(UniqueRepresentation, Set_generic):
728728

729729
@staticmethod
730730
def __classcall__(cls, *args):
@@ -1044,6 +1044,31 @@ def get_interval(self, i):
10441044
"""
10451045
return self._intervals[i]
10461046

1047+
def object(self):
1048+
"""
1049+
Return the underlying object of ``self``.
1050+
1051+
EXAMPLES::
1052+
1053+
sage: RealSet(0,1).object()
1054+
(0, 1)
1055+
"""
1056+
return self
1057+
1058+
def __nonzero__(self):
1059+
"""
1060+
A set is considered True unless it is empty, in which case it is
1061+
considered to be False.
1062+
1063+
EXAMPLES::
1064+
1065+
sage: bool(RealSet(0, 1))
1066+
True
1067+
sage: bool(RealSet())
1068+
False
1069+
"""
1070+
return not self.is_empty()
1071+
10471072
__getitem__ = get_interval
10481073

10491074
# ParentMethods of Subobjects

0 commit comments

Comments
 (0)