Serhiy Storchaka added the comment: Unfortunately there are two disadvantages:
1. wordsep_re and wordsep_simple_re are public attributes and user code can depend on this. Changing their is a way to customize TextWrapper. 2. This is slowdown common case (no abnormally long words): $ ./python -m timeit -s 'import textwrap; s = "abcde " * 10**4' -- 'textwrap.wrap(s)' Unpatched: 178 msec per loop Patched: 285 msec per loop First reason stopped me from writing a patch. When change the way how to split words, I suggest to use undocumented re scanner. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22687> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com