summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2014-01-26 17:16:10 +0100
committerSebastian Berg <sebastian@sipsolutions.net>2014-05-04 21:06:17 +0200
commitf40831a53ff2d572f338b1445e40bc88a1167ce7 (patch)
tree3c48af9cc441a9c809d8ac995f659f391b81b6ce /numpy/lib/polynomial.py
parent17e9ff8fd67f41f0328b3963d46bbbe849bf7fbb (diff)
downloadnumpy-f40831a53ff2d572f338b1445e40bc88a1167ce7.tar.gz
MAINT: Comparison deprecation followup fixes
Makes the identity check `a = np.array([np.nan], dtype=object)` `a == a`, etc. a deprecation/futurewarning instead of just changing it. Also fixes some smaller things.
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index e85e957e0..10ae32a60 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -1193,24 +1193,12 @@ class poly1d(object):
__rtruediv__ = __rdiv__
def __eq__(self, other):
- dim = min(self.coeffs.shape[0], other.coeffs.shape[0])
- if (self.coeffs[-dim:] != other.coeffs[-dim:]).any():
+ if self.coeffs.shape != other.coeffs.shape:
return False
- elif (self.coeffs[:-dim] != 0).any():
- return False
- elif (other.coeffs[:-dim] != 0).any():
- return False
- return True
+ return (self.coeffs == other.coeffs).all()
def __ne__(self, other):
- dim = min(self.coeffs.shape[0], other.coeffs.shape[0])
- if (self.coeffs[-dim:] != other.coeffs[-dim:]).any():
- return True
- elif (self.coeffs[:-dim] != 0).any():
- return True
- elif (other.coeffs[:-dim] != 0).any():
- return True
- return False
+ return not self.__eq__(other)
def __setattr__(self, key, val):
raise ValueError("Attributes cannot be changed this way.")