'Return a boolean indicating whether a == b on the basis of
their symbolic trees.
This is the same as a.compare(b) == 0 but faster.
Notes
If a class that overrides __eq__() needs to retain the
implementation of __hash__() from a parent class, the
interpreter must be told this explicitly by setting __hash__ =
<ParentClass>.__hash__. Otherwise the inheritance of __hash__()
will be blocked, just as if __hash__ had been explicitly set to
None.
References
from http://docs.python.org/dev/reference/datamodel.html#object.__hash__'

def __eq__(self, other):

    from sympy import Pow
    if (self is other):
        return True
    if (type(self) is not type(other)):
        if (isinstance(self, Pow) and (self.exp == 1)):
            return (self.base == other)
        if (isinstance(other, Pow) and (other.exp == 1)):
            return (self == other.base)
        try:
            other = _sympify(other)
        except SympifyError:
            return NotImplemented
        if (type(self) != type(other)):
            return False
    return (self._hashable_content() == other._hashable_content())
