[Python-Dev] String methods... finally
Barry A. Warsaw
bwarsaw at cnri.reston.va.us
Fri Jun 11 20:34:08 CEST 1999
>>>>> "DA" == David Ascher <da at ski.org> writes:
DA> On Fri, 11 Jun 1999, Barry A. Warsaw wrote:
>> IMO, builtin join ought to str()ify all the elements in the
>> sequence, concatenating the results. That seems an intuitive
>> interpretation of 'join'ing a sequence. Here's my Python
>> prototype:
DA> I don't get it -- why?
DA> I'd expect join(((1,2,3), (4,5,6))) to yield (1,2,3,4,5,6),
DA> not anything involving strings.
Oh, just because I think it might useful, and would provide something
that isn't easily provided with other constructs.
Without those semantics join(((1,2,3), (4,5,6))) isn't much different
than (1,2,3) + (4,5,6), or reduce(operator.add, ((1,2,3), (4,5,6))) as
you point out.
Since those latter two are easy enough to come up with, but str()ing
the elements would require painful lambdas, I figured make the new
built in do something new.
-Barry
More information about the Python-Dev
mailing list