Skip to content

Commit e2d3929

Browse files
committed
Clarify what peek(0) does
1 parent 0be970e commit e2d3929

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/library/io.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,11 @@ than raw I/O does.
773773

774774
.. method:: peek(size=0, /)
775775

776-
Return bytes from the current position onwards without advancing the position.
777-
At least one byte of data is returned if not at EOF.
776+
Return a copy of the buffer from the current position onwards without advancing the position.
777+
778+
If *size* is zero or omitted, the returned :class:`bytes` object extends to EOF.
779+
Otherwise, at most *size* bytes are returned.
778780
Return an empty :class:`bytes` object at EOF.
779-
The number of read bytes depends on the buffer size
780-
and the current position in the internal buffer.
781781

782782
.. versionadded:: next
783783

0 commit comments

Comments
 (0)