def __eq__(self, other):
        """\
>>> SimplePolynomial() == SimplePolynomial()
True
>>> SimplePolynomial() - SimplePolynomial() == 0
True
"""
        if isinstance(other, SimplePolynomial):
            return self.terms == other.terms
        if isinstance(other, Number):
            if len(self.terms) > 1:
                return False
            try:
                self.terms[0] == other
            except IndexError:
                return other == 0
        return False
>>> SimplePolynomial() == SimplePolynomial()
True
>>> SimplePolynomial() - SimplePolynomial() == 0
True

recipes/Python/576953_Simple_polynomial_class/recipe-576953.py