Martin Panter added the comment:
The peek() method was originally added by Issue 9962, where Antoine was trying
to imitate the BufferedReader.peek() API. However because “the number of bytes
returned may be more or less than requested”, I never understood what this
methods were good for; see also Issue 5811.
I think we could at least remove the claim about “at most one single read”.
That is just describing an internal detail.
The documentation for bzip and LZMA is slightly more useful IMO because it says
“at least one byte of data will be returned, unless EOF has been reached”. This
guarantee is actually missing from the underlying BufferedReader.peek()
documentation, though I think both io and _pyio implement it.
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list