Currently, the only way to concatenate an integer to a bytes object is by 
converting the integer to bytes with a function call before concatenating. And 
there is no way to make a mutable bytes object without a function call. 

I propose an array-type string like the, or for the bytearray. It would work as 
a mutable b-string, as 

foo = a"\x00\x01\x02abcÿ"       # a-string, a mutable bytes object.
foo[0] = 123                              # Item assignment
foo+= 255                                 # Works the same as 
bytesvariable+=b"123"
foo+= a"\x255\x00"                  # Concatenation with itself
foo+= b"\x255\x00"                  # Cross compatibility with bytes objects.

This would be processed the same as, or would be the bytearray,
>>> type(a"\x00\x01\x02abcÿ")
<class 'bytearray'>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/H5W3TTDC633NCPFUYIMQ26ZWX7XM4W6S/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to