Skip to content

Commit 5a82161

Browse files
Deploy preview for PR 1231 🛫
1 parent bf51c1e commit 5a82161

584 files changed

Lines changed: 5995 additions & 5979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pr-preview/pr-1231/_sources/library/difflib.rst.txt

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
4444
complicated way on how many elements the sequences have in common; best case
4545
time is linear.
4646

47-
**Automatic junk heuristic:** :class:`SequenceMatcher` supports a heuristic that
48-
automatically treats certain sequence items as junk. The heuristic counts how many
49-
times each individual item appears in the sequence. If an item's duplicates (after
50-
the first one) account for more than 1% of the sequence and the sequence is at least
51-
200 items long, this item is marked as "popular" and is treated as junk for
52-
the purpose of sequence matching. This heuristic can be turned off by setting
53-
the ``autojunk`` argument to ``False`` when creating the :class:`SequenceMatcher`.
47+
**Junk**: :class:`SequenceMatcher` accepts an ``isjunk`` predicate and an
48+
``autojunk`` flag. Items that are considered as junk will not be considered
49+
to find similar content blocks. This can produce better results for humans
50+
(typically breaking on whitespace) and faster (because it reduces the number
51+
of possible combinations). But it can also cause pathological cases where
52+
too many items considered junk cause an unexpectedly large (but correct)
53+
diff result.
54+
You should consider tuning them or turning them off depending on your data.
55+
Moreover, only the second sequence is inspected for junk. This causes the diff
56+
output to not be symmetrical.
57+
When ``autojunk=True``, it will consider as junk the items that account for more
58+
than 1% of the sequence, if it is at least 200 items long.
5459

5560
.. versionchanged:: 3.2
5661
Added the *autojunk* parameter.
@@ -554,16 +559,6 @@ The :class:`SequenceMatcher` class has this constructor:
554559
to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an
555560
upper bound.
556561

557-
.. note::
558-
559-
Caution: The result of a :meth:`ratio` call may depend on the order of
560-
the arguments. For instance::
561-
562-
>>> SequenceMatcher(None, 'tide', 'diet').ratio()
563-
0.25
564-
>>> SequenceMatcher(None, 'diet', 'tide').ratio()
565-
0.5
566-
567562

568563
.. method:: quick_ratio()
569564

pr-preview/pr-1231/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ <h3>導航</h3>
356356
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
357357
<br>
358358
<br>
359-
最後更新於 7月 24, 2026 (00:34 UTC)。
359+
最後更新於 7月 25, 2026 (00:37 UTC)。
360360

361361
<a href="/bugs.html">發現 bug</a>
362362

pr-preview/pr-1231/bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ <h3>導航</h3>
393393
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
394394
<br>
395395
<br>
396-
最後更新於 7月 24, 2026 (00:34 UTC)。
396+
最後更新於 7月 25, 2026 (00:37 UTC)。
397397

398398
<a href="/bugs.html">發現 bug</a>
399399

pr-preview/pr-1231/c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h3>導航</h3>
365365
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
366366
<br>
367367
<br>
368-
最後更新於 7月 24, 2026 (00:34 UTC)。
368+
最後更新於 7月 25, 2026 (00:37 UTC)。
369369

370370
<a href="/bugs.html">發現 bug</a>
371371

pr-preview/pr-1231/c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ <h3>導航</h3>
577577
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
578578
<br>
579579
<br>
580-
最後更新於 7月 24, 2026 (00:34 UTC)。
580+
最後更新於 7月 25, 2026 (00:37 UTC)。
581581

582582
<a href="/bugs.html">發現 bug</a>
583583

pr-preview/pr-1231/c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ <h3>導航</h3>
514514
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
515515
<br>
516516
<br>
517-
最後更新於 7月 24, 2026 (00:34 UTC)。
517+
最後更新於 7月 25, 2026 (00:37 UTC)。
518518

519519
<a href="/bugs.html">發現 bug</a>
520520

pr-preview/pr-1231/c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ <h3>導航</h3>
996996
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
997997
<br>
998998
<br>
999-
最後更新於 7月 24, 2026 (00:34 UTC)。
999+
最後更新於 7月 25, 2026 (00:37 UTC)。
10001000

10011001
<a href="/bugs.html">發現 bug</a>
10021002

pr-preview/pr-1231/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>導航</h3>
376376
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
377377
<br>
378378
<br>
379-
最後更新於 7月 24, 2026 (00:34 UTC)。
379+
最後更新於 7月 25, 2026 (00:37 UTC)。
380380

381381
<a href="/bugs.html">發現 bug</a>
382382

pr-preview/pr-1231/c-api/buffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ <h3>導航</h3>
10671067
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
10681068
<br>
10691069
<br>
1070-
最後更新於 7月 24, 2026 (00:34 UTC)。
1070+
最後更新於 7月 25, 2026 (00:37 UTC)。
10711071

10721072
<a href="/bugs.html">發現 bug</a>
10731073

pr-preview/pr-1231/c-api/bytearray.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ <h3>導航</h3>
457457
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
458458
<br>
459459
<br>
460-
最後更新於 7月 24, 2026 (00:34 UTC)。
460+
最後更新於 7月 25, 2026 (00:37 UTC)。
461461

462462
<a href="/bugs.html">發現 bug</a>
463463

0 commit comments

Comments
 (0)