def _create_diffs_for_sets(current_path, set_a, set_b):
 resulting_diffs = pvector([]).evolver()
 for item in set_a.difference(set_b):
  resulting_diffs.append(_Remove(path=current_path, item=item))
 for item in set_b.difference(set_a):
  resulting_diffs.append(_Add(path=current_path, item=item))
 return resulting_diffs.persistent()

def _create_diffs_for_sets ( current_path , set_a , set_b ) : resulting_diffs = pvector ( [ ] ) . evolver ( ) for item in set_a . difference ( set_b ) : resulting_diffs . append ( _Remove ( path = current_path , item = item ) ) for item in set_b . difference ( set_a ) : resulting_diffs . append ( _Add ( path = current_path , item = item ) ) return resulting_diffs . persistent ( )
computes a series of _idiffchange s to turn set_a into set_b assuming that these sets are at current_path inside a nested pyrsistent object .