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 r.david.murray
Recipients chris.jerdonek, ethan.furman, gward, jcea, pitrou, r.david.murray, twouters
Date 2012-08-08.20:34:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344458095.13.0.911347910181.issue15510@psf.upfronthosting.co.za>
In-reply-to
Content
Also you will note that the return of the empty list for an empty line is exactly what you want for wrapping multiple line-break-delimited paragraphs.  Consider:

  >>> doc = "a para\nanother para\n\na third, but with an extra blank line between\n"
  >>> for line in doc.splitlines():
  ...    print('\n'.join(textwrap.wrap(line, width=5)))
  ...    if line:
  ...       print()
  a
  para

  anoth
  er
  para


  a thi
  rd,
  but
  with
  an
  extra
  blank
  line 
  betwe
  en

In other words, we need to add a blank line after our formatted paragraph, unless it is empty, in which case we don't want to add one or we'll have an extra.  This assumes that single-line-paragraphs do not have blank lines between them...if they do, then the algorithm is even simpler, as you don't need the if.
History
Date User Action Args
2012-08-08 20:34:55r.david.murraysetrecipients: + r.david.murray, twouters, gward, jcea, pitrou, chris.jerdonek, ethan.furman
2012-08-08 20:34:55r.david.murraysetmessageid: <1344458095.13.0.911347910181.issue15510@psf.upfronthosting.co.za>
2012-08-08 20:34:54r.david.murraylinkissue15510 messages
2012-08-08 20:34:54r.david.murraycreate