[Python-3000] Immutable bytes -- looking for volunteer (original) (raw)

Travis Oliphant oliphant.travis at ieee.org
Sat Sep 22 03:40:18 CEST 2007


Guido van Rossum wrote:

This may have passed in a thread where no-one was listening, so I'm repeating it here.

I'm considering the following option: bytes would always be immutable, and for the few places (mostly in io.py) where a mutable bytes buffer would be handy, we use the array module. Then it would also make sense to make b[0] return a bytes array of length 1 instead of a small int -- bytes would be more similar to str in 2.x, albeit completely incompatible with str in terms of mixed operations.

If it is decided to make bytes immutable (which sounds good to me), then I want to add my voice to those that clamor for an additional mutable object capable of allocating chunks of memory.

This object should have a C-API and have it's structure exposed to extension module writers (thus array.array does not fit the bill -- but might be a prototype if some of it is moved over to the Objects directory and given an API).

-Travis Oliphant



More information about the Python-3000 mailing list