restriction on sum: intentional bug?
Alan G Isaac
alan.isaac at gmail.com
Fri Oct 16 17:39:44 CEST 2009
I expected this to be fixed in Python 3:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: sum() can't sum strings [use ''.join(seq) instead]
Of course it is not a good way to join strings,
but it should work, should it not? Naturally,
>>> '' + 'ab' + 'cd'
Why doesn't duck typing apply to `sum`?
More information about the Python-list