On 3/1/21, mmax42...@gmail.com <mmax42...@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. _______________________________________________ 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/BRYZHZAVNCZYYOVSKOKLZMATASMU4WH6/ Code of Conduct: http://python.org/psf/codeofconduct/