Ethan Furman added the comment:

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...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15510>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to