Victor Stinner wrote:
About m.read_byte(), we have two choices:
 (a) Py_BuildValue("b", value) => 0
 (b) Py_BuildValue("y#", &value, 1) => b"\x00"

About m.write_byte(x), we have also two choices:
 (a) PyArg_ParseTuple(args, "b:write_byte", &value): write_byte(0)
 (b) PyArg_ParseTuple(args, "y#:write_byte", &value, &length) and
     check for length=1: write_byte(b"\x00")

(b) choices are close to Python 2.x API. But we can already use m.read(1)->b"\x00" and m.write(b"\x00") to use byte string of 1 byte. So it would be better to break the API and use integers, (a) choices which require also documentation changes:

I'm +1 for (a) because mmap.__getitem__ already returns integer not 1-length bytes. And as I wrote in http://bugs.python.org/msg82912, it seems that more bytes cleanup is needed in mmap documentaion/implementation. I hope someone else will look into other modules' ones. ;-)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to