[issue44194] Folding ''.join(<known number of elts>) into f-strings
Eric V. Smith
report at bugs.python.org
Thu May 20 21:10:12 EDT 2021
Eric V. Smith <eric at trueblade.com> added the comment:
To be pedantic, f-strings don't "cast" to a string, they call format(obj) on the argument. Typically this is the same as str(obj), but it need not be. I guess if all of the arguments are already exact strings then this distinction doesn't matter, but I'd have to give it some more thought.
I've never seen the pattern of joining a fixed size list, but I guess it exists in the wild. I'm skeptical that this optimization is worth doing. We should check on a real-world benchmark instead of a micro benchmark.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44194>
_______________________________________
More information about the Python-bugs-list
mailing list