Tom Lynn <tl...@users.sourceforge.net> added the comment: 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. ---------- nosy: +tlynn _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1859> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com