Message83695
| Author |
vstinner |
| Recipients |
loewis, ocean-city, vstinner |
| Date |
2009年03月17日.20:55:55 |
| SpamBayes Score |
1.631409e-07 |
| Marked as misclassified |
No |
| Message-id |
<1237323359.82.0.0530212857556.issue5391@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年03月17日 20:56:00 | vstinner | set | recipients:
+ vstinner, loewis, ocean-city |
| 2009年03月17日 20:55:59 | vstinner | set | messageid: <1237323359.82.0.0530212857556.issue5391@psf.upfronthosting.co.za> |
| 2009年03月17日 20:55:57 | vstinner | link | issue5391 messages |
| 2009年03月17日 20:55:55 | vstinner | create |
|