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 serhiy.storchaka
Recipients ezio.melotti, jayvdb, levkivskyi, pitrou, puppet, r.david.murray, rhettinger, robertjli, serhiy.storchaka, yjchen, zach.ware
Date 2015-10-28.11:04:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446030254.09.0.150519094345.issue21827@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-10-28 11:04:14serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, pitrou, ezio.melotti, r.david.murray, zach.ware, puppet, robertjli, yjchen, jayvdb, levkivskyi
2015-10-28 11:04:14serhiy.storchakasetmessageid: <1446030254.09.0.150519094345.issue21827@psf.upfronthosting.co.za>
2015-10-28 11:04:14serhiy.storchakalinkissue21827 messages
2015-10-28 11:04:13serhiy.storchakacreate