def _create_diffs_for(current_path, subobj_a, subobj_b):
 if (subobj_a == subobj_b):
  return pvector([])
 elif (isinstance(subobj_a, PClass) and isinstance(subobj_b, PClass)):
  a_dict = subobj_a._to_dict()
  b_dict = subobj_b._to_dict()
  return _create_diffs_for_mappings(current_path, a_dict, b_dict)
 elif (isinstance(subobj_a, PMap) and isinstance(subobj_b, PMap)):
  return _create_diffs_for_mappings(current_path, subobj_a, subobj_b)
 elif (isinstance(subobj_a, PSet) and isinstance(subobj_b, PSet)):
  return _create_diffs_for_sets(current_path, subobj_a, subobj_b)
 if (len(current_path) > 0):
  return pvector([_Set(path=current_path[:(-1)], key=current_path[(-1)], value=subobj_b)])
 else:
  return pvector([_Replace(value=subobj_b)])

def _create_diffs_for ( current_path , subobj_a , subobj_b ) : if ( subobj_a == subobj_b ) : return pvector ( [ ] ) elif ( isinstance ( subobj_a , PClass ) and isinstance ( subobj_b , PClass ) ) : a_dict = subobj_a . _to_dict ( ) b_dict = subobj_b . _to_dict ( ) return _create_diffs_for_mappings ( current_path , a_dict , b_dict ) elif ( isinstance ( subobj_a , PMap ) and isinstance ( subobj_b , PMap ) ) : return _create_diffs_for_mappings ( current_path , subobj_a , subobj_b ) elif ( isinstance ( subobj_a , PSet ) and isinstance ( subobj_b , PSet ) ) : return _create_diffs_for_sets ( current_path , subobj_a , subobj_b ) if ( len ( current_path ) > 0 ) : return pvector ( [ _Set ( path = current_path [ : ( - 1 ) ] , key = current_path [ ( - 1 ) ] , value = subobj_b ) ] ) else : return pvector ( [ _Replace ( value = subobj_b ) ] )
computes a series of _idiffchange s to turn subobj_a into subobj_b assuming that these subobjs are at current_path inside a nested pyrsistent object .