Message253596
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 |
|
Date |
User |
Action |
Args |
2015-10-28 11:04:14 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, pitrou, ezio.melotti, r.david.murray, zach.ware, puppet, robertjli, yjchen, jayvdb, levkivskyi |
2015-10-28 11:04:14 | serhiy.storchaka | set | messageid: <1446030254.09.0.150519094345.issue21827@psf.upfronthosting.co.za> |
2015-10-28 11:04:14 | serhiy.storchaka | link | issue21827 messages |
2015-10-28 11:04:13 | serhiy.storchaka | create | |
|