On 9/17/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > I understand. But bytes are still in flux (see the repeated requests > > for immutable bytes) > > Moreover, my feeling is that immutable byte should be > the *default*, and if you want mutable bytes you > should have to ask for it. > > This would make bytes more symmetrical with strings, > where immutability is the default, and if you want > mutability you use an array.array('c') or whatever > the equivalent will be in py3k. > > It would also help to settle the question of > whether b"xyz" should be mutable -- clearly not, > for symmetry with strings.
I'm considering the following option -- it would help if someone explored creating a patch to implement this, just to see the minimum amount of code that would need to change compared to 3.0a1: bytes are always immutable, and for the few places 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. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com