[Python-checkins] bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Miss Islington (bot)
webhook-mailer at python.org
Fri Oct 26 23:09:13 EDT 2018
https://github.com/python/cpython/commit/e389de8e3e897fa5ba4f71b0f711355fb7158049
commit: e389de8e3e897fa5ba4f71b0f711355fb7158049
branch: 2.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-26T20:09:10-07:00
summary:
bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Specify that blocks are non-overlapping. Change '!=' to '<'.
(cherry picked from commit d9bff4e81b8ca36fe6c4e90c0b9cf02bc020e713)
Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
files:
A Misc/NEWS.d/next/Library/2018-10-26-22-53-16.bpo-35079.Tm5jvF.rst
M Doc/library/difflib.rst
diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst
index 01a3bfc2cd13..7b6cce4f8abc 100644
--- a/Doc/library/difflib.rst
+++ b/Doc/library/difflib.rst
@@ -431,14 +431,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!
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 000000000000..33f6dc4d8821
--- /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 '<'.
More information about the Python-checkins
mailing list