From 4b5dabd12c42ec8033870d9bdaa783276e28f39a Mon Sep 17 00:00:00 2001 From: Lafrite Date: Mon, 22 Dec 2014 10:31:05 +0100 Subject: [PATCH] __eq__ return false if other can't be converted to polynom --- pymath/polynom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pymath/polynom.py b/pymath/polynom.py index 21dc7b9..04c82cd 100644 --- a/pymath/polynom.py +++ b/pymath/polynom.py @@ -312,8 +312,11 @@ class Polynom(object): return self.reduce() def __eq__(self, other): - o_poly = self.conv2poly(other) - return self._coef == o_poly._coef + try: + o_poly = self.conv2poly(other) + return self._coef == o_poly._coef + except TypeError: + return 0 def __add__(self, other): steps = []