def __eq__(self, other):
        """Equality testing to see if two PauliSum's are equivalent.

        :param PauliSum other: The PauliSum to compare this PauliSum with.
        :return: True if other is equivalent to this PauliSum, False otherwise.
        :rtype: bool
        """
        if not isinstance(other, (PauliTerm, PauliSum)):
            raise TypeError("Can't compare PauliSum with object of type {}.".format(type(other)))
        elif isinstance(other, PauliTerm):
            return self == PauliSum([other])
        elif len(self.terms) != len(other.terms):
            warnings.warn(UnequalLengthWarning("These PauliSums have a different number of terms."))
            return False

        return set(self.terms) == set(other.terms)
def __eq__ ( self , other ) : if not isinstance ( other , ( PauliTerm , PauliSum ) ) : raise TypeError ( "Can't compare PauliSum with object of type {}." . format ( type ( other ) ) ) elif isinstance ( other , PauliTerm ) : return self == PauliSum ( [ other ] ) elif len ( self . terms ) != len ( other . terms ) : warnings . warn ( UnequalLengthWarning ( "These PauliSums have a different number of terms." ) ) return False return set ( self . terms ) == set ( other . terms )
Equality testing to see if two PauliSum's are equivalent.

        :param PauliSum other: The PauliSum to compare this PauliSum with.
        :return: True if other is equivalent to this PauliSum, False otherwise.
        :rtype: bool