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. And bytearray function calls are 9-10x slower than b-strings.
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"ÿ" 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-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/VYXEUWSUV4VTMIVREB4NQORMASY6WZEA/ Code of Conduct: http://python.org/psf/codeofconduct/