summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2006-02-28 02:36:11 +0000
committercookedm <cookedm@localhost>2006-02-28 02:36:11 +0000
commit3e5fdde668f661e82789bdd764ee6846f43efe84 (patch)
treed439513a6315b054ac1ee9b0863c7982f1277bba /numpy/lib/polynomial.py
parent3989cad8d582c1ad3e4941a963ec20b13b67cd9d (diff)
downloadnumpy-3e5fdde668f661e82789bdd764ee6846f43efe84.tar.gz
Add __eq__ and __ne__ to poly1d
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index 5bd393cd5..c0c7c2229 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -493,6 +493,12 @@ class poly1d(object):
other = poly1d(other)
return polydiv(other, self)
+ def __eq__(self, other):
+ return (self.coeffs == other.coeffs).all()
+
+ def __ne__(self, other):
+ return (self.coeffs != other.coeffs).any()
+
def __setattr__(self, key, val):
raise ValueError, "Attributes cannot be changed this way."