Part of bzrlib.patiencediff View In Hierarchy

Compare a pair of sequences using longest common subset.

Method | __init__ | Undocumented |

Method | get_matching_blocks | Return list of triples describing matching subsequences. |

def
get_matching_blocks(self):

Return list of triples describing matching subsequences.

Each triple is of the form (i, j, n), and means that a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i and in j.

The last triple is a dummy, (len(a), len(b), 0), and is the only triple with n==0.

>>> s = PatienceSequenceMatcher(None, "abxcd", "abcd") >>> s.get_matching_blocks() [(0, 0, 2), (3, 2, 2), (5, 4, 0)]