summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libdifflib.tex
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-06-14 04:09:25 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-06-14 04:09:25 (GMT)
commit43898b4f642acf182242744181143141228ca56e (patch)
tree7698daa8590f35042e112618973b26d2f28ab8b1 /Doc/lib/libdifflib.tex
parent5d7c290b7ba9353fa443e175fe02112aa53f21b5 (diff)
downloadcpython-43898b4f642acf182242744181143141228ca56e.zip
cpython-43898b4f642acf182242744181143141228ca56e.tar.gz
cpython-43898b4f642acf182242744181143141228ca56e.tar.bz2
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".
Diffstat (limited to 'Doc/lib/libdifflib.tex')
-rw-r--r--Doc/lib/libdifflib.tex10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/lib/libdifflib.tex b/Doc/lib/libdifflib.tex
index 765accc..acb5ed1 100644
--- a/Doc/lib/libdifflib.tex
+++ b/Doc/lib/libdifflib.tex
@@ -419,6 +419,16 @@ of the other sequences.
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()