STINNER Victor <victor.stin...@haypocalc.com> added the comment: > How does that answer the question? We know what data type to > use for multiple bytes - but what data type should be used > for a single byte?
Hum, what was the question? :-) Quote of my email: « 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 (...) » Oh, I though that the question was about bytes vs str :-/ Ocean-city and I prefer the solution (a). And you Martin? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5391> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com