python string, best way to concat

peter peter.mosley at talk21.com
Thu Aug 28 04:30:46 EDT 2014


I used to struggle with the concept of ''.join(('hello ','world')) - it seemed so convoluted compared with the intuitive 'hello '+'world', and I could never remember the syntax.  Also, for the strings I was generally using the performance penalty was infinitesimal, so I was just adding complexity for the sake of the abstract concept of a more 'pythonic' style.

Obviously this isn't going to change, but for concatenating short strings a and b is there any practical reason to avoid a+b?

Peter




More information about the Python-list mailing list