Skip to content

gh-154661: Reorganize difflib documentation - #154662

Merged
encukou merged 2 commits into
python:mainfrom
encukou:difflib-doc
Jul 28, 2026
Merged

gh-154661: Reorganize difflib documentation#154662
encukou merged 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.

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.

There's no harm in keeping some of the page's old-timey charm :)

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.

@encukou
encukou merged commit 1a40b7b into python:main Jul 28, 2026
33 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jul 28, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@encukou
encukou deleted the difflib-doc branch July 28, 2026 09:04
@bedevere-app

bedevere-app Bot commented Jul 28, 2026

Copy link
Copy Markdown

GH-154805 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 28, 2026
@bedevere-app

bedevere-app Bot commented Jul 28, 2026

Copy link
Copy Markdown

GH-154806 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 28, 2026
@bedevere-app

bedevere-app Bot commented Jul 28, 2026

Copy link
Copy Markdown

GH-154807 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 28, 2026
hugovk added a commit that referenced this pull request Jul 28, 2026
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
hugovk added a commit that referenced this pull request Jul 28, 2026
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
hugovk added a commit that referenced this pull request Jul 28, 2026
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants