[Python-Dev] Re: Fwd: summing a bunch of numbers (or "whatevers")

Terry Reedy tjreedy@udel.edu
Mon, 21 Apr 2003 15:01:32 -0400


"Guido van Rossum" <guido@python.org> wrote in message
news:200304211248.h3LCmw622763@pcp02138704pcs.reston01.va.comcast.net.
..
> sum(sequence_of_strings) is out.  *If* "".join() is really too ugly
(I
> still think it's a matter of getting used to, like indentation), we
> could add join(seq, delim) as a built-in.  VB has one. :-)

Given that we already have the 'less ugly' alternative str.join(delim,
strseq),
both sum(strseq) and a hypothetical builtin seem unnecessary.  And, an
explicit udelim.join(sseq) or unicode.join(udelim, sseq) nicely
handles mixed seqs without type guessing.

>>> str.join('', ['a','b','c']
'abc'
>>> unicode.join(u'', ['a',u'b'])
u'ab'

Terry J. Reedy