2 ms·
Interesting! ''.join() has the advantage on longer strings though: $ python -mtimeit "'aaaaaaaaaaaaaaa' + 'bbbbbbbbbbbbbbb' + 'ccccccccccccccc' + 'dddddddddddd
by Ysx 15y ago
Interesting! ''.join() has the advantage on longer strings though:
$ python -mtimeit "'aaaaaaaaaaaaaaa' + 'bbbbbbbbbbbbbbb' + 'ccccccccccccccc' + 'ddddddddddddddd'"
1000000 loops, best of 3: 0.224 usec per loop
$ python -mtimeit "''.join(('aaaaaaaaaaaaaaa','bbbbbbbbbbbbbbb','ccccccccccccccc','ddddddddddddddd'))"
10000000 loops, best of 3: 0.201 usec per loop
- kqueue 15y agoThat's definitely interesting.