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. > > 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. (The challenge includes making all the tests pass > again.)
I don't know if I mentioned this before, since (a) I didn't want to be a distraction while you were busy trying to make mutable bytes work everywhere, and (b) I didn't want to sound completely insane. However - here is my vision of how things would look in an ideal world: Data Type AbstractSequence Immutable Mutable ========= ================ ========= ======= byte ByteSequence bytes buffer character CharSequence str strbuf 'buffer' could be an array.array, although if it's used frequently enough an optimized special-case 'buffer' class might be better. And it can have methods that array doesn't have. -- Talin _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
