8000 bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH… · python/cpython@5282125 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5282125

Browse files
bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Specify that blocks are non-overlapping. Change '!=' to '<'. (cherry picked from commit d9bff4e) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent 7eac88a commit 5282125

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Doc/library/difflib.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,15 @@ The :class:`SequenceMatcher` class has this constructor:
457457

458458
.. method:: get_matching_blocks()
459459

460-
Return list of triples describing matching subsequences. Each triple is of
461-
the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The
460+
Return list of triples describing non-overlapping matching subsequences.
461+
Each triple is of the form ``(i, j, n)``,
462+
and means that ``a[i:i+n] == b[j:j+n]``. The
462463
triples are monotonically increasing in *i* and *j*.
463464

464465
The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It
465466
is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')``
466467
are adjacent triples in the list, and the second is not the last triple in
467-
the list, then ``i+n != i'`` or ``j+n != j'``; in other words, adjacent
468+
the list, then ``i+n < i'`` or ``j+n < j'``; in other words, adjacent
468469
triples always describe non-adjacent equal blocks.
469470

470471
.. XXX Explain why a dummy is used!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve difflib.SequenceManager.get_matching_blocks doc by adding 'non-
2+
overlapping' and changing '!=' to '<'.

0 commit comments

Comments
 (0)
0