[Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

Joel Bender jjb5 at cornell.edu
Fri Sep 28 15:58:38 CEST 2007


Should this PEP include changes to the struct module, or should it be a 
separate PEP?

I would like struct.pack() to return bytes and struct.unpack() to accept 
bytes or buffers but not strings.  The 's' and 'p' format specifier 
should refer to bytes and not strings.

In protocol encoding and decoding, "unpack and strip off the front" and 
"pack and append" are very common operations.  I would also like to have 
  buffer.unpack(fmt) be the former and buffer.pack(fmt, v1, v2, ...) be 
the latter.


Joel


More information about the Python-3000 mailing list