[issue5811] io.BufferedReader.peek(): Documentation differs from Implementation

Nick Coghlan report at bugs.python.org
Sun Jun 14 03:12:29 CEST 2009


Nick Coghlan <ncoghlan at gmail.com> added the comment:

It's not the docstring that is wrong for the current behaviour, it's the
IO.BufferedReader documentation:

"""
peek([n])
    Return 1 (or n if specified) bytes from a buffer without advancing
the position. Only a single read on the raw stream is done to satisfy
the call. The number of bytes returned may be less than requested since
at most all the buffer’s bytes from the current position to the end are
returned.
"""

That gives absolutely no indication that the call might return more
bytes than expected, and the indication that leaving out the argument
will return only the next byte is flat out wrong.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5811>
_______________________________________


More information about the Python-bugs-list mailing list