[Python-ideas] The non-obvious nature of str.join (was Re: sum(...) limitation)
Ethan Furman
ethan at stoneleaf.us
Tue Aug 12 00:13:40 CEST 2014
On 08/11/2014 02:53 PM, Nathaniel Smith wrote:
>>
>> Quite frankly, I regard this as a point in sum's favor. We have, effectively, a string-subclass and join chokes on it.
>
> Yes, but the proposal I was responding to was to do something like
>
> def sum(it, start=0):
> if start == "":
> return "".join(it)
> ... regular sum impl here ...
>
> And the point is that this is not trivially a transparent optimization.
Ah, gotcha.
Even without an optimization in sum, I'd still rather it did what it said: add things together.
--
~Ethan~
More information about the Python-ideas
mailing list