I know that ''.join(list)
is the preferred method to concatenate strings as opposed to say:
for x in list:
s += x
My question is why is this much faster?
Also, what if I need to concatenate items that are not already in a list? Is it still faster to put them in a list just for the purpose of doing the ''.join(list)
?
EDIT: This is different than the previously linked question because I'm specifically interested in knowing if the items are not in a list already, is it still recommended for performance reasons to put them in a list for the sole purpose of joining.