From abce2cc45a479d342fd907a497bf9e77e79379c5 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 17 Aug 2023 22:13:06 +0200 Subject: [PATCH 1/3] gh-107801: Improve the docs of the SEEK_* constants --- Doc/library/os.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 94b76e4052b94b..70a0c6561c5bc0 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1180,8 +1180,15 @@ as internal buffering of data. SEEK_CUR SEEK_END - Parameters to the :func:`lseek` function. Their values are 0, 1, and 2, - respectively. + Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` + method on file object, for whence to adjust the file position indicator. + + :const:`SEEK_SET` + Adjust the file position relative to the beginning of the file. + :const:`SEEK_CUR` + Adjust the file position relative to the current file position. + :const:`SEEK_END` + Adjust the file position relative to the end of the file. .. data:: SEEK_HOLE From 7fa4d3ad27a62296eff7d44e60b46afe998f1bec Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 17 Aug 2023 22:15:15 +0200 Subject: [PATCH 2/3] Also mention values --- Doc/library/os.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 70a0c6561c5bc0..ea693fa8b832a9 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1190,6 +1190,8 @@ as internal buffering of data. :const:`SEEK_END` Adjust the file position relative to the end of the file. + Their values are 0, 1, and 2, respectively. + .. data:: SEEK_HOLE SEEK_DATA From a006a93ca26de632be9d73e51355a6977b0a853b Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 17 Aug 2023 22:31:36 +0200 Subject: [PATCH 3/3] File-like objects --- Doc/library/os.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index ea693fa8b832a9..4668984b10c690 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1181,7 +1181,8 @@ as internal buffering of data. SEEK_END Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` - method on file object, for whence to adjust the file position indicator. + method on :term:`file-like objects `, + for whence to adjust the file position indicator. :const:`SEEK_SET` Adjust the file position relative to the beginning of the file. @@ -1197,8 +1198,8 @@ as internal buffering of data. SEEK_DATA Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` - method on file objects, for seeking file data and holes on sparsely - allocated files. + method on :term:`file-like objects `, + for seeking file data and holes on sparsely allocated files. :data:`!SEEK_DATA` Adjust the file offset to the next location containing data,