[Python-ideas] The non-obvious nature of str.join (was Re: sum(...) limitation)

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Aug 11 18:22:59 CEST 2014


On Mon, Aug 11, 2014 at 11:55 AM, Todd <toddrjen at gmail.com> wrote:

> In my experience, it is the asymmetry between x.join(y) and x.split(y)
>> which causes most of the confusion.  In x.join(y), x is the separator and y
>> is the data being joined, but in x.split(y), it is the other way around.
>>
>
> What would be the solution to this?
>

Allow sum(list_of_strings, '') and stop mocking people who prefer it to
''.join(..).  This will not solve all the issues with join/split, but at
least a simple task of concatenating a list of strings will have a more or
less obvious solution.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140811/49003a10/attachment.html>


More information about the Python-ideas mailing list