[Python-ideas] All ideas together: Fast sum() for non-numbers

Paul Moore p.f.moore at gmail.com
Fri Jul 5 09:59:55 CEST 2013


On 5 July 2013 08:41, Sergey <sergemp at mail.ru> wrote:

> 2. Fast sum() for strings. [3]
>    This patch is a small enhancement of #1, that makes sum() O(N) for
>    strings. Obviously it introduces a behavior change and I do NOT
>    suggest it for inclusion. I believe that ''.join() alternative is
>    simple enough and don't have to be replaces with sum() for normal
>    use cases. It is just to shows that sum() can be O(N) for strings.
>

Why does this "obviously" introduce a behaviour change? If it is just a
performance improvement, that's not a behaviour change.

Can you clarify what behaviour will change? Also, why does there need to be
a behaviour change for strings and not for any other type (you make no
mention of behaviour changes anywhere else in this message that I can see).

It's hard to see why there would be any argument over *pure* performance
improvements. But behaviour changes, especially ones which are "needed" to
get performance benefits, are a different matter.

Apologies if this has already been discussed, but this thread has become
quite complex, and I haven't been following the details (and thanks for the
summary, BTW!)

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130705/d492ba8d/attachment-0001.html>


More information about the Python-ideas mailing list