Skip to content

Conversation

@AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Mar 31, 2025

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

There is a note:

Note that tabs and spaces are both treated as whitespace, but they are not
equal: the lines ``"  hello"`` and ``"\thello"`` are considered to have no
common leading whitespace.

The new implementation still guarantees this right?

Comment on lines 1081 to 1082
characters other than space and tab.

Copy link
Member

@picnixz picnixz Mar 31, 2025

Choose a reason for hiding this comment

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

Add something like (to be able to see the issue)

  characters other than space and tab.
  (Contributed by [...] in :gh:`...`.)

+ 2 blank lines to end the section.

@picnixz picnixz changed the title Add a What's New entry for the changes to textwrap.dedent gh-130167: Add a What's New entry for the changes to textwrap.dedent Mar 31, 2025

* Optimise the :func:`~textwrap.dedent` function, improving performance by
an average of 2.4x, with larger improvements for bigger inputs,
and fix a bug with incomplete normalization of blank lines with whitespace
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use two separate bullet points for that? so that the reader is able to distinguish between a performance improvement and a behavioral change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Where should the second one go? Improved Modules is mainly for features, and a standalone bullet about the bugfix in Optimisations feels wrong.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I think it's still an improvement in some sense (even if we didn't treat it as a regular bugfix that we backport). For me I think that the behavioral change is important to note, hence I suggested using two separate bullet points (but still under the same section)

@AA-Turner AA-Turner changed the title gh-130167: Add a What's New entry for the changes to textwrap.dedent gh-130167: Add a What's New entry for the changes to textwrap.{de,in}dent Apr 1, 2025
@AA-Turner AA-Turner changed the title gh-130167: Add a What's New entry for the changes to textwrap.{de,in}dent gh-130167: Add a What's New entry for changes to textwrap.{de,in}dent Apr 1, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@picnixz
Copy link
Member

picnixz commented Apr 17, 2025

@AA-Turner Can you also include the typo fix of the NEWS entry (https://github.com/python/cpython/pull/131923/files#r2044429846)? TiA

@hugovk hugovk added the needs backport to 3.14 bugs and security fixes label Jun 27, 2025
@hugovk
Copy link
Member

hugovk commented Jun 27, 2025

Reminder for this :)

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. I have no opinion about normalised/normalized, please came to some conclusion.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@hugovk
Copy link
Member

hugovk commented Dec 28, 2025

@AA-Turner Can you also include the typo fix of the NEWS entry (#131923 (files))? TiA

(Was fixed in #132666)

Comment on lines +2274 to +2275
characters other than space and tab.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
characters other than space and tab.
characters other than space and tab.

an average of 2.4x, with larger improvements for bigger inputs,
and fix a bug with incomplete normalization of blank lines with whitespace
characters other than space and tab.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

print(repr(s)) # prints ' hello\n world\n '
print(repr(dedent(s))) # prints 'hello\n world\n'

.. versionchanged:: next
Copy link
Member

@picnixz picnixz Dec 29, 2025

Choose a reason for hiding this comment

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

I'm not sure it's "next" since the change was achieved in 3.14.0 (or something like that)

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.14 bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants