Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libdifflib.tex @ 38811:4558916b841f legacy-trunk
SequenceMatcher.get_matching_blocks(): This now guarantees that
adjacent triples in the result list describe non-adjacent matching
blocks. That's _nice_ to have, and Guido said he wanted it.
Not a bugfix candidate: Guido or not ;-), this changes visible
endcase semantics (note that some tests had to change), and
nothing about this was documented before. Since it was working
as designed, and behavior was consistent with the docs, it wasn't
"a bug".
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Wed, 14 Jun 2006 04:09:25 +0000 |
| parents | 67f2190e1f6d |
| children | 00c02c4488ce |
line wrap: on
line diff
--- a/Doc/lib/libdifflib.tex Tue Jun 13 22:53:48 2006 +0000 +++ b/Doc/lib/libdifflib.tex Wed Jun 14 04:09:25 2006 +0000 @@ -419,6 +419,16 @@ len(\var{b}), 0)}. It is the only triple with \code{\var{n} == 0}. % Explain why a dummy is used! + If + \code{(\var{i}, \var{j}, \var{n})} and + \code{(\var{i'}, \var{j'}, \var{n'})} are adjacent triples in the list, + and the second is not the last triple in the list, then + \code{\var{i}+\var{n} != \var{i'}} or + \code{\var{j}+\var{n} != \var{j'}}; in other words, adjacent triples + always describe non-adjacent equal blocks. + \versionchanged[The guarantee that adjacent triples always describe + non-adjacent blocks was implemented]{2.5} + \begin{verbatim} >>> s = SequenceMatcher(None, "abxcd", "abcd") >>> s.get_matching_blocks()
