Re:Python Practices for Efficient Code: Performance, Memory,...
by fnl on Sunday August 27, 2017 @05:01AM
(#15109827)
So the conclusion is: Have an existing list to join? Use str.join(list); Otherwise, operator+ might be your friend, but f-strings are probably cleaner to handle (but you only get those in Py3.6+). As to str.format(): Nah, not good.
Didn't expect str.format() to turn out to be "so" poor, though.
But this conclusion is taken w/o looking into the "old" formatting approach, `"%s%s%s%s" % (a, b, c, d)`, though.
Didn't expect str.format() to turn out to be "so" poor, though.
But this conclusion is taken w/o looking into the "old" formatting approach, `"%s%s%s%s" % (a, b, c, d)`, though.