On Mon, Jul 23, 2018 at 22:25:14 +0100, Gustavo Carneiro wrote:
> Well, even if it is worth, i.e. your use case is not rare enough,
Reading a single byte is certainly a special case, but I think it's generic
enough to warrant its own function.
I believe there should be many binary protocols out th
Well, even if it is worth, i.e. your use case is not rare enough, I would
suggest at least making it private, readexactly can call this specialised
function if nbytes==1:
def _readbyte(self):
def readexactly(self, num):
if num == 1:
return self._readbyte()
... the rest stays th
Hello,
I'm implementing a protocol where I need to read individual bytes until
a condition is met (value & 0x80 == 0).
My current approach is: value = (await reader.readexactly(1))[0]
To speed this up, I propose that a new function is added to
asyncio.StreamReader: value = await reader.readbyte(