New submission from sam: >>> 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. ---------- messages: 55822 nosy: sam severity: normal status: open title: TextWrap vs words 1-character shorter than the width type: behavior versions: Python 2.5 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1146> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com