From 8f395b96cab4bf5a84fca7e493729677480c1af2 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 26 Oct 2018 22:49:52 -0400 Subject: [PATCH 1/2] bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc. --- Doc/library/difflib.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst index 6743bdc1d87b9d..f044cb2d6e0a86 100644 --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -457,14 +457,15 @@ The :class:`SequenceMatcher` class has this constructor: .. method:: get_matching_blocks() - 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 + Return list of triples describing non-overlapping 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 *j*. The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')`` are adjacent triples in the list, and the second is not the last triple in - the list, then ``i+n != i'`` or ``j+n != j'``; in other words, adjacent + the list, then ``i+n < i'`` or ``j+n < j'``; in other words, adjacent triples always describe non-adjacent equal blocks. .. XXX Explain why a dummy is used! From 5025becb5505ac0180a6b942a36cfa7547cd6670 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 26 Oct 2018 22:53:52 -0400 Subject: [PATCH 2/2] blurb --- .../next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst diff --git a/Misc/NEWS.d/next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst b/Misc/NEWS.d/next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst new file mode 100644 index 00000000000000..33f6dc4d882137 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst @@ -0,0 +1,2 @@ +Improve difflib.SequenceManager.get_matching_blocks doc by adding 'non- +overlapping' and changing '!=' to '<'.