[Python-ideas] Fast sum() for non-numbers - why so much worries?
Terry Reedy
tjreedy at udel.edu
Thu Jul 11 21:20:01 CEST 2013
On 7/11/2013 1:53 AM, Ronald Oussoren wrote:
>
> On 11 Jul, 2013, at 7:27, Stephen J. Turnbull <stephen at xemacs.org> wrote:
>> It does count; it's a language change. It is not a bug-fix in which
>> the implementation is brought into line with the language definition.
>
> That doesn't mean that using += instead of + in sum isn't a valid change
> to make for 3.4.
Breaking code in the way this would do, would require a PEP and
deprecation cycle. I do not anticipate approval for a general change.
A specialized change such that sum(iterable_of_lists, []) would extend
rather than replace [] might be done since the result would be equal to
the current result, just faster, and since [] must be nearly always
passed without aliases that depend on it not changing. Even that should
have a deprecation warning.
Tuples could be linearly summed in a list with .extend and then
converted at the end. I don't believe that would be a semantic change at
all.
> BTW. This thread has been rehashing the same arguments over and over again,
> and it's pretty likely that most core devs have stopped following this thread
Right, I just happened to pick this post because you are also a core dev.
> because of that. It's probably time for someone to write a summary
> the discussion (what are the proposals and the arguments in favor and against them)
--
Terry Jan Reedy
More information about the Python-ideas
mailing list