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

Commit

Permalink
get rid of cmp and __cmp__ in complex interval fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed May 23, 2017
1 parent 7a36941 commit f960e2e
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/sage/rings/complex_interval_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ class ComplexIntervalField_class(ring.Field):
We can load and save complex numbers and the complex interval field::
sage: cmp(loads(z.dumps()), z)
0
sage: saved_z = loads(z.dumps())
sage: saved_z.endpoints() == z.endpoints()
True
sage: loads(CIF.dumps()) == CIF
True
sage: k = ComplexIntervalField(100)
Expand Down Expand Up @@ -375,7 +376,7 @@ def _middle_field(self):
self.__middle_field = complex_field.ComplexField(self._prec)
return self.__middle_field

def __cmp__(self, other):
def __eq__(self, other):
"""
Compare ``other`` to ``self``.
Expand All @@ -384,16 +385,31 @@ def __cmp__(self, other):
EXAMPLES::
sage: cmp(CIF, ComplexIntervalField(200))
-1
sage: cmp(CIF, CC) != 0
sage: CIF == ComplexIntervalField(200)
False
sage: CIF == CC
False
sage: CIF == CIF
True
sage: cmp(CIF, CIF)
0
"""
if not isinstance(other, ComplexIntervalField_class):
return cmp(type(self), type(other))
return cmp(self._prec, other._prec)
return False
return self._prec == other._prec

def __ne__(self, other):
"""
Test for unequality.
EXAMPLES::
sage: CIF != ComplexIntervalField(200)
True
sage: CIF != CC
True
sage: CIF != CIF
False
"""
return not (self == other)

def __call__(self, x, im=None):
"""
Expand Down

0 comments on commit f960e2e

Please sign in to comment.