Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-32397: new option for TextWrapper to allow stable wrapping#27587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
akulakov wants to merge9 commits intopython:main
base:main
Choose a base branch
Loading
fromakulakov:32397-Add-textwrap-arg-for-stable-wrapping

Conversation

akulakov
Copy link
Contributor

@akulakovakulakov commentedAug 4, 2021
edited
Loading

The new optionfold_space_newline performs a more natural whitespace replacement for newlines, e.g.

'foo\n bar' => 'foo bar'instead of'foo\n bar' => 'foo  bar'(with two spaces).

More importantly, it allows for "stable" wrapping when combined withdrop_whitespace=False, i.e. wrap() can be applied multiple times producing the same output (see the Issue).

https://bugs.python.org/issue32397

… tests for replace_whitespace and fold_space_newline
@ned-deilyned-deily removed their request for reviewSeptember 5, 2021 20:22
@MaxwellDupre
Copy link
Contributor

Could you re-target whatsnew for 3.12?

akulakov reacted with thumbs up emoji

@akulakov
Copy link
ContributorAuthor

@MaxwellDupre moved the what's new note from 3.11 to 3.12.

@MaxwellDupre
Copy link
Contributor

Built fresh with
./configure --with-pydebug
make -s -j

But fails:
./python /home/me/PycharmProjects/TestingPy/32397-textwrap.py
original: 'xxxx xxxx xxxx xxxx xxxx. xxxx'
wrapped: 'xxxx xxxx xxxx xxxx xxxx.\nxxxx'
wrapped twice: 'xxxx xxxx xxxx xxxx xxxx. xxxx'

Traceback (most recent call last):
File "/home/me/PycharmProjects/TestingPy/32397-textwrap.py", line 27, in
assert wrapped == wrapped2
^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
!  ~/D/G/cpython   32397-Add-textwrap-arg-for-stable-wrapping $

Im on Fedora 5.18.6-200.fc36.x86_64

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

@terryjreedyterryjreedyterryjreedy left review comments

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

@iritkatrieliritkatrielAwaiting requested review from iritkatriel

@larryhastingslarryhastingsAwaiting requested review from larryhastings

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@akulakov@MaxwellDupre@terryjreedy@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp