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 tlynn
Recipients BreamoreBoy, georg.brandl, gvanrossum, gward, jerith, mark.dickinson, mrabarnett, palfrey, terry.reedy, tlynn
Date 2010-11-23.21:34:02
SpamBayes Score 3.8785238e-08
Marked as misclassified No
Message-id <1290548045.62.0.753348686502.issue1859@psf.upfronthosting.co.za>
In-reply-to
Content
I've also been attempting to look into this and came up with an almost identical patch, which is promising:
https://bitbucket.org/tlynn/issue1859/diff/textwrap.py?diff2=041c9deb90a2&diff1=f2c093077fbf

I missed the wordsep_simple_re though.

Testing it is the hard part.  I've got a few examples that could become tests in that repository, but it's far from conclusive.

One corner case I found is trailing whitespace becoming a blank line:

>>> from textwrap import TextWrapper
>>> T = TextWrapper(replace_whitespace=False, drop_whitespace=False, width=9)
>>> T.wrap('x'*9 + ' \nfoo')
['xxxxxxxxx', ' ', 'foo']

I think it's fine.  drop_whitespace=True removes the blank line, and those who really want drop_whitespace=False can remove the blank lines easily.
History
Date User Action Args
2010-11-23 21:34:06tlynnsetrecipients: + tlynn, gvanrossum, gward, georg.brandl, terry.reedy, mark.dickinson, palfrey, jerith, mrabarnett, BreamoreBoy
2010-11-23 21:34:05tlynnsetmessageid: <1290548045.62.0.753348686502.issue1859@psf.upfronthosting.co.za>
2010-11-23 21:34:02tlynnlinkissue1859 messages
2010-11-23 21:34:02tlynncreate