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 gvanrossum, mark.dickinson, palfrey, tlynn
Date 2009-11-19.13:52:22
SpamBayes Score 1.2710388e-12
Marked as misclassified No
Message-id <1258638745.35.0.917730127591.issue1859@psf.upfronthosting.co.za>
In-reply-to
Content
This bug should be re-opened, since there is definitely a bug here.  
I think the patch was incorrectly rejected.

If I can expand palfrey's example:

from textwrap import *
T = TextWrapper(replace_whitespace=False, width=75)
text = '''\
aaaaa aaaaa aaaaa aaaaa aaaaa
bbbbb bbbbb bbbbb bbbbb bbbbb
ccccc ccccc ccccc ccccc ccccc
ddddd ddddd ddddd ddddd ddddd
eeeee eeeee eeeee eeeee eeeee'''
for line in T.wrap(text): print line

Python 2.5 textwrap turns it into:

aaaaa aaaaa aaaaa aaaaa aaaaa
bbbbb bbbbb bbbbb bbbbb bbbbb
ccccc ccccc
ccccc ccccc ccccc
ddddd ddddd ddddd ddddd ddddd
eeeee eeeee eeeee eeeee
eeeee

That can't be right.  palfrey's patch leaves the input unchanged, which 
seems correct to me.  I think Guido guessed wrong here: the docs for 
replace_whitespace say:

  If true, each whitespace character (as defined by string.whitespace)
  remaining after tab expansion will be replaced by a single space

The text should therefore not be reflowed in this case since 
replace_whitespace=False.  palfrey's patch seems correct to me.

It can be made to reflow to the full width by editing palfrey's patch, 
but that would disagree with the docs and break code.
History
Date User Action Args
2009-11-19 13:52:25tlynnsetrecipients: + tlynn, gvanrossum, mark.dickinson, palfrey
2009-11-19 13:52:25tlynnsetmessageid: <1258638745.35.0.917730127591.issue1859@psf.upfronthosting.co.za>
2009-11-19 13:52:23tlynnlinkissue1859 messages
2009-11-19 13:52:22tlynncreate