
On 3/1/21, mmax42852@gmail.com <mmax42852@gmail.com> wrote:
And there is no way to make a mutable bytes object without a function call.
Since a code object is immutable, the proposed bytearray display form would still require an internal operation that constructs a bytearray from a bytes object. For example, something like the following: BUILD_BYTEARRAY 0 LOAD_CONST 0 (b'spam') BYTEARRAY_EXTEND 1
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
Concatenating a sequence with a number shouldn't be allowed. OTOH, I think `foo += [255]` should be supported as foo.extend([255]), but bytearray doesn't allow it currently. `foo.append(255)` is supported.