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

Commit

Permalink
24171: make RealSet inherit from Set_generic
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Nov 8, 2017
1 parent 669ea22 commit 34c9773
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/sage/sets/real_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RealSet.
#*****************************************************************************

from sage.structure.richcmp import richcmp, richcmp_method
from sage.structure.parent import Parent
from sage.structure.parent import Parent, Set_generic
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.sets_cat import Sets
from sage.rings.all import ZZ
Expand Down Expand Up @@ -590,7 +590,7 @@ def contains(self, x):


@richcmp_method
class RealSet(UniqueRepresentation, Parent):
class RealSet(UniqueRepresentation, Set_generic):

@staticmethod
def __classcall__(cls, *args):
Expand Down Expand Up @@ -796,6 +796,31 @@ def get_interval(self, i):
"""
return self._intervals[i]

def object(self):
"""
Return the underlying object of ``self``.
EXAMPLES::
sage: RealSet(0,1).object()
(0, 1)
"""
return self

def __nonzero__(self):
"""
A set is considered True unless it is empty, in which case it is
considered to be False.
EXAMPLES::
sage: bool(RealSet(0, 1))
True
sage: bool(RealSet())
False
"""
return not self.is_empty()

__getitem__ = get_interval

@staticmethod
Expand Down

0 comments on commit 34c9773

Please sign in to comment.