restriction on sum: intentional bug?

ryles rylesny at gmail.com
Sat Oct 17 00:53:01 CEST 2009


On Oct 16, 11:39 am, Alan G Isaac <alan.is... at gmail.com> wrote:
> I expected this to be fixed in Python 3:
>
> >>> sum(['ab','cd'],'')
>
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> TypeError: sum() can't sum strings [use ''.join(seq) instead]

Then you probably haven't read through these discussions:

sum and strings: http://mail.python.org/pipermail/python-list/2006-August/subject.html
summing a bunch of numbers: http://mail.python.org/pipermail/python-dev/2003-April/subj



More information about the Python-list mailing list