[Python-Dev] sum(...) limitation
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>
> All the suggestions
> I've seen so far are (IMHO, YMMV) just as ugly as the present
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...
More information about the Python-Dev