Message270095
For comparison:
$ ./python -m timeit -s "x = 2" -- "f'X is {x}'"
1000000 loops, best of 3: 1.04 usec per loop
$ ./python -m timeit -s "x = 2; j = ''.join" -- "j(['X is ', f'{x}'])"
1000000 loops, best of 3: 0.93 usec per loop
$ ./python -m timeit -s "x = 2" -- "'X is {}'.format(x)"
1000000 loops, best of 3: 0.808 usec per loop
$ ./python -m timeit -s "x = 2; f = 'X is {}'.format" -- "f(x)"
1000000 loops, best of 3: 0.748 usec per loop
$ ./python -m timeit -s "x = 2" -- "'X is %s' % (x,)"
1000000 loops, best of 3: 0.467 usec per loop |
|
Date |
User |
Action |
Args |
2016-07-10 16:08:44 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, mjpieters, eric.smith, ztane |
2016-07-10 16:08:43 | serhiy.storchaka | set | messageid: <1468166923.98.0.0562751375955.issue27078@psf.upfronthosting.co.za> |
2016-07-10 16:08:43 | serhiy.storchaka | link | issue27078 messages |
2016-07-10 16:08:43 | serhiy.storchaka | create | |
|