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.

Author ethan.furman
Recipients chris.jerdonek, ethan.furman, gward, jcea, pitrou, r.david.murray, twouters
Date 2012-08-08.20:17:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5022CCDB.2060007@stoneleaf.us>
In-reply-to <1344392568.77.0.994801768422.issue15510@psf.upfronthosting.co.za>
Content
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...
History
Date User Action Args
2012-08-08 20:17:46ethan.furmansetrecipients: + ethan.furman, twouters, gward, jcea, pitrou, r.david.murray, chris.jerdonek
2012-08-08 20:17:45ethan.furmanlinkissue15510 messages
2012-08-08 20:17:44ethan.furmancreate