So I recently read an article online about optimizing Python, and it said that concatenating strings with .join()
concatenatedString = " ".join (["Hello", "world!"])
is quicker than with the + operator
concatenatedString = "Hello " + "world!"
I tried both of them on a python debugger, and I found that using .join()
is indeed quicker than using the + operator.
Why is this?