[Python-3000] Weird error message from bytes type

Georg Brandl g.brandl at gmx.net
Mon Feb 26 00:52:30 CET 2007

Thomas Wouters schrieb:
> This is because a bytes object is not a sequence of bytes objects, like 
> strings. It's a sequence of small integer values, so you need to assign 
> a small integer value to it. You can assign b'a'[0] to it, or assign 
> b'a' to x[:1]. I guess we could specialcase length-1 bytes to make this 
> work 'naturally', but I'm not sure that's the right approach. Guido?

If it is deemed right, see attached patch.

BTW, is it intentional that the setitem/setslice code is duplicated in

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bytes-ass.diff
Url: http://mail.python.org/pipermail/python-3000/attachments/20070226/faef94aa/attachment.diff 

More information about the Python-3000 mailing list