MCPcopy Index your code
hub / github.com/python/cpython / set_seq1

Method set_seq1

Lib/difflib.py:197–221  ·  view source on GitHub ↗

Set the first sequence to be compared. The second sequence to be compared is not changed. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.set_seq1("bcde") >>> s.ratio() 1.0 >>> SequenceMatcher computes

(self, a)

Source from the content-addressed store, hash-verified

195 self.set_seq2(b)
196
197 def set_seq1(self, a):
198 """Set the first sequence to be compared.
199
200 The second sequence to be compared is not changed.
201
202 >>> s = SequenceMatcher(None, "abcd", "bcde")
203 >>> s.ratio()
204 0.75
205 >>> s.set_seq1("bcde")
206 >>> s.ratio()
207 1.0
208 >>>
209
210 SequenceMatcher computes and caches detailed information about the
211 second sequence, so if you want to compare one sequence S against
212 many sequences, use .set_seq2(S) once and call .set_seq1(x)
213 repeatedly for each of the other sequences.
214
215 See also set_seqs() and set_seq2().
216 """
217
218 if a is self.a:
219 return
220 self.a = a
221 self.matching_blocks = self.opcodes = None
222
223 def set_seq2(self, b):
224 """Set the second sequence to be compared.

Callers 3

set_seqsMethod · 0.95
get_close_matchesFunction · 0.95
_fancy_replaceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected