[Python-Dev] sum(...) limitation

Raymond Hettinger raymond.hettinger at gmail.com
Sat Aug 9 02:34:34 CEST 2014


On Aug 8, 2014, at 11:09 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

>> So why not apply a similar optimization to sum() for strings?
> 
> That I cannot answer -- I find the current situation with sum highly irritating.
> 

It is only irritating if you are misusing sum().

The str.__add__ optimization was put in because
it was common for people to accidentally incur
the performance penalty.

With sum(), we don't seem to have that problem
(I don't see people using it to add lists except
just to show that could be done).


Raymond


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140808/bdaa3fd7/attachment.html>


More information about the Python-Dev mailing list