From 3e5fdde668f661e82789bdd764ee6846f43efe84 Mon Sep 17 00:00:00 2001 From: cookedm Date: Tue, 28 Feb 2006 02:36:11 +0000 Subject: Add __eq__ and __ne__ to poly1d --- numpy/lib/polynomial.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'numpy/lib/polynomial.py') 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." -- cgit v1.2.1