Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db4220e

Browse files
author
Martin Panter
committed
Issue #25030: Do not document seek() as if it accepts keyword arguments
Patch from Shiyao Ma.
1 parent 91c03e0 commit db4220e

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

Doc/library/io.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ I/O Base Classes
301301
Note that it's already possible to iterate on file objects using ``for
302302
line in file: ...`` without calling ``file.readlines()``.
303303

304-
.. method:: seek(offset, whence=SEEK_SET)
304+
.. method:: seek(offset[, whence])
305305

306306
Change the stream position to the given byte *offset*. *offset* is
307-
interpreted relative to the position indicated by *whence*. Values for
308-
*whence* are:
307+
interpreted relative to the position indicated by *whence*. The default
308+
value for *whence* is :data:`SEEK_SET`. Values for *whence* are:
309309

310310
* :data:`SEEK_SET` or ``0`` -- start of the stream (the default);
311311
*offset* should be zero or positive
@@ -760,10 +760,11 @@ Text I/O
760760

761761
If *size* is specified, at most *size* characters will be read.
762762

763-
.. method:: seek(offset, whence=SEEK_SET)
763+
.. method:: seek(offset[, whence])
764764

765-
Change the stream position to the given *offset*. Behaviour depends
766-
on the *whence* parameter:
765+
Change the stream position to the given *offset*. Behaviour depends on
766+
the *whence* parameter. The default value for *whence* is
767+
:data:`SEEK_SET`.
767768

768769
* :data:`SEEK_SET` or ``0``: seek from the start of the stream
769770
(the default); *offset* must either be a number returned by

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,7 @@ Alexander Shigin
12761276
Pete Shinners
12771277
Michael Shiplett
12781278
John W. Shipman
1279+
Shiyao Ma
12791280
Alex Shkop
12801281
Joel Shprentz
12811282
Yue Shuaijie

Modules/_io/bytesio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ bytesio_iternext(bytesio *self)
530530
}
531531

532532
PyDoc_STRVAR(seek_doc,
533-
"seek(pos, whence=0) -> int. Change stream position.\n"
533+
"seek(pos[, whence]) -> int. Change stream position.\n"
534534
"\n"
535535
"Seek to byte offset pos relative to position indicated by whence:\n"
536536
" 0 Start of stream (the default). pos should be >= 0;\n"

0 commit comments

Comments
 (0)