Author chris.jerdonek
Recipients chris.jerdonek, ethan.furman, gward, jcea, pitrou, r.david.murray, twouters
Date 2012-08-08.02:22:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344392568.77.0.994801768422.issue15510@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for weighing in, Greg!

At least for me, this edge case was important because it determines how the canonical advice or recipe for handling multiple paragraphs behaves when the input string has line breaks in between paragraphs.  That advice, of course, is to call splitlines(), pass the individual paragraphs to wrap(), and then join on newlines.

Here is an example on a paragraph with line breaks between paragraphs:

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

> If you want it defined, write tests to enforce the status quo and improve the docs.

Given the discussion so far (and in particular, opposition to changing behavior), this is the route I'm hoping we can go.  Interesting or not, I think it's good that we at least had this discussion before setting the behavior in stone. :)
History
Date User Action Args
2012-08-08 02:22:49chris.jerdoneksetrecipients: + chris.jerdonek, twouters, gward, jcea, pitrou, r.david.murray, ethan.furman
2012-08-08 02:22:48chris.jerdoneksetmessageid: <1344392568.77.0.994801768422.issue15510@psf.upfronthosting.co.za>
2012-08-08 02:22:48chris.jerdoneklinkissue15510 messages
2012-08-08 02:22:47chris.jerdonekcreate