Title: bytes.join does not accept a sequence of bytearrays
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, benjamin.peterson, georg.brandl, pitrou
Priority: normal Keywords:

Created on 2008-08-01 17:47 by pitrou, last changed 2010-10-21 13:40 by georg.brandl. This issue is now closed.

Messages (4)
msg70573 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-01 17:47
This works in py3k but not in 2.x. I don't know if it is deliberate:

Python 3.0b2+ (py3k, Jul 27 2008, 12:52:40) 
[GCC 4.3.1 20080626 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> b"".join([bytearray(b"")])

Python 2.6b2+ (trunk, Aug  1 2008, 01:47:52) 
[GCC 4.3.1 20080626 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> b"".join([bytearray(b"")])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sequence item 0: expected string, bytearray found
msg70576 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-01 17:54
I suppose this is because bytes is simply aliased to str. I propose we
just leave it as is. The ultimate solution is probably backporting th
py3k PyBytes type.
msg87929 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2009-05-16 20:44
How about adding a note on this to 2.6 docs and be done with it?
msg119293 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-10-21 13:40
py3k bytes won't be backported now.
Date User Action Args
2010-10-21 13:40:05georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg119293

resolution: wont fix
2009-05-16 20:44:46ajaksu2setnosy: + ajaksu2
messages: + msg87929
2008-08-01 17:54:02benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg70576
2008-08-01 17:47:29pitroucreate