pygsti.baseobjs.mongoserializable.recursive_compare_str

pygsti.baseobjs.mongoserializable.recursive_compare_str#

recursive_compare_str(a, b, a_name='first obj', b_name='second obj', prefix='', diff_accum=None)#

Compares two objects and generates a list of strings describing how they differ.

Recursively traverses dictionaries, tuples, and lists.

Parameters:
  • a (object) – The objects to compare

  • b (object) – The objects to compare

  • a_name (str, optional) – Names for the a and b objects for referencing them in the output strings.

  • b_name (str, optional) – Names for the a and b objects for referencing them in the output strings.

  • prefix (str, optional) – An optional prefix to the descriptions in the returned strings.

  • diff_accum (list, optional) – An existing list that is accumulating difference-descriptions. None means start a new list.

Returns:

A list of strings, each describing a difference between the objects.

Return type:

list