mirror of
https://github.com/python/cpython.git
synced 2025-12-07 17:57:56 +00:00
bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Specify that blocks are non-overlapping. Change '!=' to '<'.
This commit is contained in:
parent
12e696b4f0
commit
d9bff4e81b
2 changed files with 6 additions and 3 deletions
|
|
@ -457,14 +457,15 @@ The :class:`SequenceMatcher` class has this constructor:
|
||||||
|
|
||||||
.. method:: get_matching_blocks()
|
.. method:: get_matching_blocks()
|
||||||
|
|
||||||
Return list of triples describing matching subsequences. Each triple is of
|
Return list of triples describing non-overlapping matching subsequences.
|
||||||
the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The
|
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*.
|
triples are monotonically increasing in *i* and *j*.
|
||||||
|
|
||||||
The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It
|
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')``
|
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
|
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.
|
triples always describe non-adjacent equal blocks.
|
||||||
|
|
||||||
.. XXX Explain why a dummy is used!
|
.. XXX Explain why a dummy is used!
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Improve difflib.SequenceManager.get_matching_blocks doc by adding 'non-
|
||||||
|
overlapping' and changing '!=' to '<'.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue