Antti Haapala added the comment: So does this (new opcode) count as a new feature? It would be great to give f'' strings a flying start, saying that not only they're cool, they're also faster than anything that you've used before.
Here some more mini-benchmarks with serhiy's patch2 applied, the times are pretty stable: % python3.6 -mtimeit -s 'x = 42' '"%s-" % x' 10000000 loops, best of 3: 0.184 usec per loop % python3.6 -mtimeit -s 'x = 42' 'f"{x}-"' 10000000 loops, best of 3: 0.142 usec per loop and % python3.6 -mtimeit -s 'x = "42"' 'f"{x}{x}"' 10000000 loops, best of 3: 0.0709 usec per loop % python3.6 -mtimeit -s 'x = "42"' '"%s%s" % (x,x)' 1000000 loops, best of 3: 0.213 usec per loop python3.6 -mtimeit -s 'x = "42"' '"".join((x, x))' 10000000 loops, best of 3: 0.155 usec per loop This is only really achievable with some kind of bytecode support. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27078> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com