[issue41740] string concatenation via `sum`
Marco Paolini
report at bugs.python.org
Mon Sep 7 17:49:37 EDT 2020
Marco Paolini <markopaolini at gmail.com> added the comment:
also worth noting, the start argument is type checked instead. Maybe we could apply the same checks to the items of the iterable?
python3 -c "print(sum(('a', 'b', 'c'), start='d'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: sum() can't sum strings [use ''.join(seq) instead]
see https://github.com/python/cpython/blob/c96d00e88ead8f99bb6aa1357928ac4545d9287c/Python/bltinmodule.c#L2310
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41740>
_______________________________________
More information about the Python-bugs-list
mailing list