On 13/02/13 19:52, Larry Hastings wrote:
I've always hated the "".join(array) idiom for "fast" string concatenation --it's ugly and it flies in the face of TOOWTDI. I think everyone should use "x = a + b + c + d" for string concatenation, and we should just make that fast.
"".join(array) is much nicer looking than: # ridiculous and impractical for more than a few items array[0] + array[1] + array[2] + ... + array[N] or: # not an expression result = "" for s in array: result += s or even: # currently prohibited, and not obvious sum(array, "") although I will admit to a certain fondness towards # even less obvious than sum map(operator.add, array) and join has been the obvious way to do repeated concatenation of many substrings since at least Python 1.5 when it was spelled "string.join(array [, sep=" "]). -- Steven _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com