Skip to content

gh-154661: Reorganize difflib documentation - #154662

Open
encukou wants to merge 2 commits into
python:mainfrom
encukou:difflib-doc
Open

gh-154661: Reorganize difflib documentation#154662
encukou wants to merge 2 commits 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

read-the-docs-community Bot commented Jul 24, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33780055 | 📁 Comparing 300edbc against main (59e67c2)

  🔍 Preview build  

7 files changed · ± 7 modified

± Modified

@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 Outdated
Comment thread Doc/library/difflib.rst Outdated
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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

in is correct here -- the behaviour depends on how many elements the sequences have in common, but the relation isn't linear, or quadratic, or otherwise simple.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This PR just moves this text; I'd rather keep the original wording unchanged.
Merriam-Webster recognizes both sync & synch.

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.

And acknowledges "less commonly synch" :) But fine to keep it as is in this PR.

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*

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let's keep the original for now.

Comment thread Doc/library/difflib.rst Outdated
@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).

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

@encukou encukou left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for proofreading!

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 Author

Choose a reason for hiding this comment

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

in is correct here -- the behaviour depends on how many elements the sequences have in common, but the relation isn't linear, or quadratic, or otherwise simple.

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 Author

Choose a reason for hiding this comment

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

This PR just moves this text; I'd rather keep the original wording unchanged.
Merriam-Webster recognizes both sync & synch.

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 Author

Choose a reason for hiding this comment

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

Let's keep the original for now.

@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.

Thanks!

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.

And acknowledges "less commonly synch" :) But fine to keep it as is in this PR.

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

Labels

awaiting merge 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