New submission from Antoine Pitrou <pit...@free.fr>: ... while it apparently shouldn't:
>>> sum([b'', b''], b'') b'' >>> sum([b'', b''], bytearray()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sum() can't sum bytes [use b''.join(seq) instead] In 2.7, the situation is the reverse: >>> sum([b'', b''], b'') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sum() can't sum strings [use ''.join(seq) instead] >>> sum([b'', b''], bytearray()) bytearray(b'') ---------- components: Interpreter Core messages: 141363 nosy: mark.dickinson, pitrou, rhettinger priority: normal severity: normal stage: needs patch status: open title: sum() works with bytes objects type: behavior versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12654> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com