summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-18 17:53:51 (GMT)
committerGitHub <noreply@github.com>2023-08-18 17:53:51 (GMT)
commitdd4442c8f597af1ec3eaf20f7ad89c4ac7e2dbc9 (patch)
tree8cc7ae0459d623a8f5dc23b6aa13467caa987523 /Doc/library
parent6db39b1460727e8820b45e5c083e5839af0352aa (diff)
downloadcpython-dd4442c8f597af1ec3eaf20f7ad89c4ac7e2dbc9.zip
cpython-dd4442c8f597af1ec3eaf20f7ad89c4ac7e2dbc9.tar.gz
cpython-dd4442c8f597af1ec3eaf20f7ad89c4ac7e2dbc9.tar.bz2
gh-107801: Improve the accuracy of os.lseek docs (#107935)
- name the last parameter *whence*, like it is for seek() methods on file objects - add param docstrings - structure the valid *whence* params Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/os.rst17
1 files changed, 11 insertions, 6 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 4668984..7d63ac1 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1163,17 +1163,22 @@ as internal buffering of data.
.. versionadded:: 3.11
-.. function:: lseek(fd, pos, how, /)
+.. function:: lseek(fd, pos, whence, /)
Set the current position of file descriptor *fd* to position *pos*, modified
- by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the
- beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the
- current position; :const:`SEEK_END` or ``2`` to set it relative to the end of
- the file. Return the new cursor position in bytes, starting from the beginning.
+ by *whence*, and return the new position in bytes relative to
+ the start of the file.
+ Valid values for *whence* are:
+
+ * :const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file
+ * :const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position
+ * :const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file
+ * :const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*
+ * :const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*
.. versionchanged:: 3.3
- Add support for :const:`SEEK_HOLE` and :const:`SEEK_DATA`.
+ Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`.
.. data:: SEEK_SET