libb.same_order

same_order(ref_list, comp)

Compare two lists and check if elements in ref appear in same order in comp.

Args:

ref_list: Reference list of elements. comp: Comparison list to check order against.

Returns:

True if all ref elements appear in comp in the same relative order.

Examples:
>>> same_order(['x', 'y', 'z'], ['x', 'a', 'b', 'y', 'd', 'z'])
True
>>> same_order(['x', 'y', 'z'], ['x', 'z', 'y'])
False