Skip to content

gh-154661: Reorganize difflib documentation#154662

Open
encukou wants to merge 1 commit into
python:mainfrom
encukou:difflib-doc
Open

gh-154661: Reorganize difflib documentation#154662
encukou wants to merge 1 commit into
python:mainfrom
encukou:difflib-doc

Conversation

@encukou

@encukou encukou commented Jul 24, 2026

Copy link
Copy Markdown
Member
  • Put common information in an intro section at the beginning, rather than in a duplicate doc entry for SequenceMatcher
  • Merge the two doc entries for Differ
  • Document timing as a CPython implementation detail
  • Group examples together

- Put common information in an intro section at the beginning, rather
  than in a duplicate doc entry for `SequenceMatcher`
- Merge the two doc entries for `Differ`
- Document timing as a CPython implementation detail
- Group examples together
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33751673 | 📁 Comparing 4bcbafe against main (59e67c2)

  🔍 Preview build  

2 files changed
± library/difflib.html
± library/text.html

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, much clearer 👍

Comment thread Doc/library/difflib.rst
Junk heuristic
--------------

:mod:`!difflib` uses a :dfn:`junk` heuristic: Some items are deemed to be

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:mod:`!difflib` uses a :dfn:`junk` heuristic: Some items are deemed to be
:mod:`!difflib` uses a :dfn:`junk` heuristic: some items are deemed to be

Comment thread Doc/library/difflib.rst
-----------------------------

The algorithm used in :class:`SequenceMatcher` predates, and is a little
fancier than, an algorithm published in the late 1980's by Ratcliff and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fancier than, an algorithm published in the late 1980's by Ratcliff and
fancier than, an algorithm published in the late 1980s by Ratcliff and

Comment thread Doc/library/difflib.rst
The basic Ratcliff-Obershelp algorithm is cubic time in the worst
case and quadratic time in the expected case.
:mod:`difflib`'s algorithm is quadratic time for the worst case and has
expected-case behavior dependent in a complicated way on how many elements

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expected-case behavior dependent in a complicated way on how many elements
expected-case behavior dependent on a complicated way on how many elements

Comment thread Doc/library/difflib.rst
Comment on lines +124 to +126
because they synch up anywhere possible, sometimes at accidental matches
100 pages apart.
Restricting synch points to contiguous matches preserves some notion of

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use "sync" everywhere else, and avoids mispronunciation as "sinch" (which I have heard):

Suggested change
because they synch up anywhere possible, sometimes at accidental matches
100 pages apart.
Restricting synch points to contiguous matches preserves some notion of
because they sync up anywhere possible, sometimes at accidental matches
100 pages apart.
Restricting sync points to contiguous matches preserves some notion of

Comment thread Doc/library/difflib.rst
Comment on lines +146 to +147
be ignored. Read the description of the
:meth:`~SequenceMatcher.find_longest_match` method's *isjunk*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps? (and may need an escape)

Suggested change
be ignored. Read the description of the
:meth:`~SequenceMatcher.find_longest_match` method's *isjunk*
be ignored. Read the description of
:meth:`~SequenceMatcher.find_longest_match`'s *isjunk*

Comment thread Doc/library/difflib.rst
Comment on lines +159 to +160
:meth:`~io.IOBase.readlines` method of file-like objects. The delta
generated also consists of newline-terminated strings, ready to be

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:meth:`~io.IOBase.readlines` method of file-like objects. The delta
generated also consists of newline-terminated strings, ready to be
:meth:`~io.IOBase.readlines` method of file-like objects. The generated
delta also consists of newline-terminated strings, ready to be

@hugovk hugovk added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 25, 2026
@hugovk

hugovk commented Jul 25, 2026

Copy link
Copy Markdown
Member

And let's backport (if trivial).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants