Serhiy Storchaka added the comment: LGTM. But the implementation can be more efficient. Here is optimized patch.
34e88a05562f.diff: $ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" "*100)' -- 'textwrap.dedent(s)' 10000 loops, best of 3: 87.5 usec per loop $ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" "*1000)' -- 'textwrap.dedent(s)' 1000 loops, best of 3: 780 usec per loop issue21827.patch: $ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" "*100)' -- 'textwrap.dedent(s)' 10000 loops, best of 3: 51 usec per loop $ ./python -m timeit -s 'import textwrap; s = "{0} x\n{0}\tx\n".format(" "*1000)' -- 'textwrap.dedent(s)' 1000 loops, best of 3: 395 usec per loop ---------- nosy: +serhiy.storchaka stage: needs patch -> patch review versions: -Python 3.2, Python 3.3 Added file: http://bugs.python.org/file40873/issue21827.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21827> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com