+ vs join

String join is significantly faster then concatenation.

Why? Strings are immutable and can't be changed in place. To alter one, a new representation needs to be created (a concatenation of the two).

References

[1] Wayne [email protected], How slow is Python's string concatenation vs. str.join?

[2] [email protected], Efficient String Concatenation in Python

results matching ""

    No results matching ""