[docs] [issue18424] sum() does not return only the sum of a sequence of numbers + PEP8 reccomandation

Marco Buttu report at bugs.python.org
Wed Jul 10 17:21:31 CEST 2013


Marco Buttu added the comment:

By reading the Ronald's comment, I realized it is better to keep it simple, so I agree with him.

The "extremely inefficient" reason seems to be less important (Python 3.3):

$ python -m timeit -s "a=['a']*10000; b=['b']*10000; a+b"
100000000 loops, best of 3: 0.00831 usec per loop
$ python -m timeit -s "a=['a']*10000; b=['b']*10000; sum([a, b], [])"
100000000 loops, best of 3: 0.0087 usec per loop

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18424>
_______________________________________


More information about the docs mailing list