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

Alexander Belopolsky alexander.belopolsky at gmail.com
Sat Aug 9 20:02:58 CEST 2014


On Sat, Aug 9, 2014 at 3:08 AM, Stephen J. Turnbull <stephen at xemacs.org>
wrote:

> All the suggestions
> I've seen so far are (IMHO, YMMV) just as ugly as the present
> situation.
>

What is ugly about allowing strings?  CPython certainly has a way to to
make sum(x, '') at least as efficient as y='';for in in x; y+= x is now.
 What is ugly about making sum([a, b, ..]) be equivalent to a + b + .. so
that non-empty lists of arbitrary types can be "summed"?  What is ugly
about harmonizing sum(x) and reduce(operator.add, x) behaviors?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140809/e276636b/attachment.html>


More information about the Python-Dev mailing list