Nick Coghlan wrote: > Martin v. Löwis wrote: >> I don't think it needs to be a separate type, >> instead, bytes objects could have a idem-potent >> .freeze() method which switches the "immutable" >> bit on. There would be no way to switch it off >> again. > > +1 here - hashable byte sequences are very handy for dealing with > fragments of low level serial protocols. > > It would also be nice if b"" literals set that immutable flag > automatically - otherwise converting some of my lookup tables over to > Py3k would be a serious pain (not a pain I'm likely to have to deal with > personally given the relative time frames involved, but a pain nonetheless).
I'm also for an immutable bytes type - but I'm not so sure about freezing in place. The most efficient representation of immutable bytes is quite different from the most efficient representation of mutable bytes. Rather, I think that they should both share a common Abstract Base Class defining what you can do with immutable byte strings, but the actual storage of the bytes themselves should be implemented in the subclass. -- 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
