> Apologies if this has been answered before, but why are you waiting > for a show-stopper that requires an immutable bytes type rather than > one that requires a mutable one?
You mean, the need for a mutable bytes type might not be clear yet? Code that has been ported to the bytes type probably doesn't use it correctly yet, but to me, the need for a buffery thing where you can allocate some buffer, and then fill it byte-for-byte is quite obvious. It's a standard thing in all kinds of communication protocols: in sending, you allocate plenty of memory, fill it, and then send the fraction you actually consumed. In receiving, you allocate plenty of memory (not knowing yet how much you will receive), then only process as much as you needed. You do all that without creating new buffers all the time - you use a single one over and over again. Code that has been ported to bytes from str8 often tends to still follow the immutable pattern, creating a list of bytes objects to be joined later - this can be improved in code reviews. > Taking TOOWTDI as a guideline: If you have immutable bytes and need a > mutable object, just use list(). I don't think this is adequate. Too much lower-level API relies on having memory blocks, and that couldn't be implemented efficiently with a list. Regards, Martin _______________________________________________ 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
