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 sam
Recipients sam
Date 2007-09-11.13:37:36
SpamBayes Score 0.05322607
Marked as misclassified No
Message-id <1189517857.01.0.116632649875.issue1146@psf.upfronthosting.co.za>
In-reply-to
Content
>>> from textwrap import wrap
>>> wrap("foobarbaz reallylongwordgoeshere", width = 10)
['foobarbaz r', 'eallylongw', 'ordgoesher', 'e']
>>> print [len(s) for s in _]
[11, 10, 10, 1]

This only seems to happen when the first word on the line is exactly one
character shorter than the width, and the next word is too long to fit,
so it is broken:

>>> wrap("foo bar reallylongwordgoeshere", width = 7)
['foo bar', 'reallyl', 'ongword', 'goesher', 'e']
>>> wrap("foobarbaz really longwordgoeshere", width = 10)
['foobarbaz', 'really lon', 'gwordgoesh', 'ere']
>>> wrap("foobarbaz reallylongwordgoeshere", width = 10,
break_long_words = False)
['foobarbaz', 'reallylongwordgoeshere']

This is on Python 2.5, on Windows XP SP2.
History
Date User Action Args
2007-09-11 13:37:37samsetspambayes_score: 0.0532261 -> 0.05322607
recipients: + sam
2007-09-11 13:37:37samsetspambayes_score: 0.0532261 -> 0.0532261
messageid: <1189517857.01.0.116632649875.issue1146@psf.upfronthosting.co.za>
2007-09-11 13:37:37samlinkissue1146 messages
2007-09-11 13:37:36samcreate