def copy(self):
        """
        Properly creates a new PauliTerm, with a completely new dictionary
        of operators
        """
        new_term = PauliTerm("I", 0, 1.0)  # create new object
        # manually copy all attributes over
        for key in self.__dict__.keys():
            val = self.__dict__[key]
            if isinstance(val, (dict, list, set)):  # mutable types
                new_term.__dict__[key] = copy.copy(val)
            else:  # immutable types
                new_term.__dict__[key] = val

        return new_term
def copy ( self ) : new_term = PauliTerm ( "I" , 0 , 1.0 ) for key in self . __dict__ . keys ( ) : val = self . __dict__ [ key ] if isinstance ( val , ( dict , list , set ) ) : new_term . __dict__ [ key ] = copy . copy ( val ) else : new_term . __dict__ [ key ] = val return new_term
Properly creates a new PauliTerm, with a completely new dictionary
        of operators