sum and strings

Georg Brandl g.brandl-nospam at gmx.net
Fri Aug 18 08:16:06 EDT 2006


Paul Rubin wrote:
> Sybren Stuvel <sybrenUSE at YOURthirdtower.com.imagination> writes:
>> Because of "there should only be one way to do it, and that way should
>> be obvious". There are already the str.join and unicode.join methods,
> 
> Those are obvious??? 

Why would you try to sum up strings? Besides, the ''.join idiom is quite
common in Python.

In this special case, ''.join is much faster than sum() which is why
sum() denies to concat strings.

Georg



More information about the Python-list mailing list