➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 ethan.furman
收信人 chris.jerdonek, ethan.furman, gward, jcea, pitrou, r.david.murray, twouters
日期 2012-08-08.20:17:44
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <5022CCDB.2060007@stoneleaf.us>
In-reply-to <1344392568.77.0.994801768422.issue15510@psf.upfronthosting.co.za>
内容
Chris Jerdonek wrote:
> Here is an example on a paragraph with line breaks between paragraphs:

s/paragraph/text/

>>>> def wrap_paras(text, width=70, **kwargs):
> ...     lines = [line for para in text.splitlines()
> ...                   for line in wrap(para, width, **kwargs)]
> ...     return "\n".join(lines)
> ...
>>>> text = """\
> ... abcd abcd
> ...
> ... abcd abcd"""
>>>> print(wrap_paras(text))
> abcd abcd
> abcd abcd
> 
> The edge case we're discussing determines whether line breaks between paragraphs are preserved in the result.  (With current behavior, they are not.)

Having now more carefully read the docs (which, admittedly, I should 
have done before responding the first time) I found this:

textwrap.wrap(text, width=70, **kwargs)
	Wraps the single paragraph in text . . .

textwrap.fill(text, width=70, **kwargs)
	Wraps the single paragraph in text, . . .

In other words, it is not designed to work on multiple paragraphs at 
once.  And the documentation is fine.

Move along, no bug to see here, move along...
历史
日期 用户 动作 参数
2012-08-08 20:17:46ethan.furman修改recipients: + ethan.furman, twouters, gward, jcea, pitrou, r.david.murray, chris.jerdonek
2012-08-08 20:17:45ethan.furman链接issue15510 messages
2012-08-08 20:17:44ethan.furman创建